fix(core): append assetQueryParams to inter-chunk JS imports (#15964)#16110
Conversation
🦋 Changeset detectedLatest commit: ebf6975 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
can we use es-module-lexer for this? we already use it in some places like here: Definitely want to make sure we're getting both static and dynamic imports. |
@matthewp Thanks for the review! I'll refactor to use |
1453e8d to
6256749
Compare
|
Hi, @matthewp |
|
No it's a flaky test, I'll rerun it. |
|
Fixes #14775 |
|
Hi @matthewp |
|
@tmimmanuel Code looks good, can you add a changeset? |
|
@matthewp |
|
@matthewp |
| await init; | ||
| const [imports] = parse(code); | ||
|
|
||
| // Filter to relative JS imports only |
There was a problem hiding this comment.
why filter to only relative imports?
There was a problem hiding this comment.
I think Vite only generates relative paths for inter-chunk references in bundled output. But please let me know if there's a case I might be missing.
There was a problem hiding this comment.
Ah yeah that's right, ok this is good.
|
@matthewp Thanks. |
Changes
assetQueryParams(e.g.,?dpl=<VERCEL_DEPLOYMENT_ID>), breaking Vercel skew protection for code-split appsrenderChunkplugin (plugin-chunk-imports.ts) that rewrites relative import paths in client chunks to include the configured query parametersassetQueryParamsis not configuredBefore:
After:
Closes #15964
Testing
appends assetQueryParams to relative imports inside client JS chunksasset-query-paramstests pass?dpl=on relativefrom"./..."importsassetQueryParamsconfigured (no regression for non-Vercel builds)Docs
No docs changes needed.