fix(vite): let a framework flavor exclude packages from the dev deps bundle seed - #11442
Merged
Merged
Conversation
|
View your CI Pipeline Execution ↗ for commit 040b2e1
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
…bundle seed
The dev deps bundle is seeded from every root in the app's `dependencies`,
so an Octane app vendored `octane/dist/index.js` and its whole DOM-side
graph on every dev boot, although the compiler rewrites every `octane`
import in compiled components to `@nativescript-community/octane`, which
only imports `octane/universal/native`.
`registerFrameworkFlavor` now accepts `vendor: { exclude: [...] }`; the
vendor collection skips those roots (and their peer traversal) exactly as
`NS_VENDOR_EXCLUDE` does. With `@nativescript-community/vite-octane`
declaring `vendor: { exclude: ['octane'] }`, the first-boot deps bundle of
the octane sample app drops from 82 to 42 modules (1.68MB to 639KB), and
the `universal/native` closure is all that remains of octane.
Closes #11440
NathanWalker
force-pushed
the
fix/vite-flavor-vendor-exclude
branch
from
September 22, 2026 23:32
f180e75 to
040b2e1
Compare
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.
PR Checklist
What is the current behavior?
The dev deps bundle (
/ns/deps-bundle.mjs) is seeded from every root in the app'sdependencies. An Octane app listsoctane(it is a peer of@nativescript-community/octane), sooctane/dist/index.jsand its whole DOM-side graph (runtime.js,dom-tables.js,hydration/*,server-rpc-*,css.js, ...) are vendored and evaluated on every dev boot. Nothing on the device imports them: the Octane compiler rewritesfrom 'octane'in the components it owns to@nativescript-community/octane, which imports onlyoctane/universal/native. Raw app source still saysfrom 'octane', so import evidence cannot tell the two apart; only the flavor knows.What is the new behavior?
registerFrameworkFlavoraccepts an optionalvendor: { exclude: string[] }. The vendor collection treats those roots exactly likeNS_VENDOR_EXCLUDE: never seeded, never traversed for peers, still reachable through whichever vendored package imports them, and anything the device fetches that the bundle lacks stays on the per-module path and is recorded for the next boot. The policy is keyed by flavor, so other flavors are unaffected. Malformed policies are rejected at registration.@nativescript-community/vite-octanegains a one-linevendor: { exclude: ['octane'] }(companion change in the community repo; the walkthrough indocs/framework-flavors.mdshows it).Measured on the octane sample app, first-boot deps bundle (iOS, dev, no recording):
dist/index.js,dom-tables.js,hydration/*,server-rpc-client.js)universal/nativeclosure only)Verified on the iOS simulator: the app boots from the reduced bundle with no JS errors and the drawer/composer (Octane hooks and external stores) work.
Tests:
registerFrameworkFlavorvalidation and lookup,collectVendorModuleshonoring the flavor policy (including the peer-traversal path) and leaving other flavors untouched, andresolveDepsEntriesFromVendorCollectionomitting the excluded root from both the seed and the vendor specifier map. Note:typescript-optional.spec.tsfails undernx run vite:testonmainas well (passes under directvitest), unrelated to this change.Closes #11440.