fix(vite): serve deps-bundle shims for barrels that re-export a bare package - #11427
Merged
Merged
Conversation
…package Under HMR every bundled node_modules file must be served as a thin shim into /ns/deps-bundle.mjs, and the shim needs the file's static export list. Export discovery gave up on `export * from '<pkg>'`, so nativescript-vue's index (which re-exports @vue/runtime-core) was served raw on top of its bundled copy and ran `init()` twice. Any per-module-served Vue plugin that imports `nativescript-vue` then failed to boot with "Element for AbsoluteLayout already registered". Bare re-export targets are now resolved from the importer the way Node does (nearest node_modules ancestor, exports map including patterns, platform suffixes) and followed. Only targets that resolve nowhere still fall back to per-module serving. The app's `__FOO__` defines (the Vue feature flags @vitejs/plugin-vue sets) are also passed to the deps-bundle build so bundled dep code sees the same values as bundle.mjs.
|
View your CI Pipeline Execution ↗ for commit 8f9637f
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Under HMR every bundled node_modules file must be served as a thin shim into /ns/deps-bundle.mjs, and the shim needs the file's static export list. Export discovery gave up on
export * from '<pkg>', so nativescript-vue's index (which re-exports @vue/runtime-core) was served raw on top of its bundled copy and raninit()twice. Any per-module-served Vue plugin that importsnativescript-vuethen failed to boot with "Element for AbsoluteLayout already registered". Found when testing deeper with@nativescript-community/ui-collectionview.Bare re-export targets are now resolved from the importer the way Node does (nearest node_modules ancestor, exports map including patterns, platform suffixes) and followed. Only targets that resolve nowhere still fall back to per-module serving. The app's
__FOO__defines (the Vue feature flags @vitejs/plugin-vue sets) are also passed to the deps-bundle build so bundled dep code sees the same values as bundle.mjs.