Fix app deploy including stale dist files in the extension bundle - #8236
Fix app deploy including stale dist files in the extension bundle#8236alfonso-noriega wants to merge 1 commit into
Conversation
…ist files Assisted-By: devx/5fc43aa0-53a8-47e0-94e5-0f1620777a6c
|
The fix restores the pre-3.94 contract (only build artifacts reach the bundle), but two risks with the glob approach:
Recommendation: copy the exact file list from esbuild's build result instead of globbing — |
WHY are these changes introduced?
Related to #6069.
Since 3.94.0 (0986095),
executeBundleUIStepbuilds the UI extension into the extension's localdist/directory and then copies the whole directory into the deploy bundle. Any stale file sitting indist/(a script built under an old handle, a dev's own bundler output, old sourcemaps/metafiles) ships inside the module.For web pixel extensions this is fatal: core's
FetchScriptContentrejects modules whose uploaded files contain more than one.js, soappVersionCreatefails with a generic "Version couldn't be created" even though every prior step (build, GCS upload) succeeds.dist/is gitignored, so reverting source changes doesn't clear it — which is why "the same source deployed fine before and now fails".Root cause analysis in this Slack thread. Server-side error message improvement in https://github.com/shop/world/pull/967972.
WHAT is this pull request doing?
bundle-ui-step.ts: instead of copying the entire local output directory, copy only the artifacts produced by the build —<output-name>.*for the main entry and each extra asset (which also covers their sourcemaps and.metafile.json). Stale files next to the built ones no longer ship..jsin the localdist/is excluded from the bundle; extra built assets (e.g.-conditions.js) are still copied.How to test your changes?
shopify.extension.toml(leaving the oldextensions/<pixel>/dist/<old-handle>.jsin place) and runshopify app deploy.appVersionCreatefails ("Version couldn't be created"); with it, only the freshly built script is included and the deploy succeeds.Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add