Skip to content

fix(vite): let a framework flavor exclude packages from the dev deps bundle seed - #11442

Merged
NathanWalker merged 1 commit into
mainfrom
fix/vite-flavor-vendor-exclude
Sep 22, 2026
Merged

NathanWalker merged 1 commit into
mainfrom
fix/vite-flavor-vendor-exclude

Conversation

@NathanWalker

@NathanWalker NathanWalker commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

The dev deps bundle (/ns/deps-bundle.mjs) is seeded from every root in the app's dependencies. An Octane app lists octane (it is a peer of @nativescript-community/octane), so octane/dist/index.js and 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 rewrites from 'octane' in the components it owns to @nativescript-community/octane, which imports only octane/universal/native. Raw app source still says from 'octane', so import evidence cannot tell the two apart; only the flavor knows.

What is the new behavior?

registerFrameworkFlavor accepts an optional vendor: { exclude: string[] }. The vendor collection treats those roots exactly like NS_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-octane gains a one-line vendor: { exclude: ['octane'] } (companion change in the community repo; the walkthrough in docs/framework-flavors.md shows it).

Measured on the octane sample app, first-boot deps bundle (iOS, dev, no recording):

modules payload octane files
before 82 1.68 MB 40 (incl. dist/index.js, dom-tables.js, hydration/*, server-rpc-client.js)
after 42 639 KB 8 (the universal/native closure 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: registerFrameworkFlavor validation and lookup, collectVendorModules honoring the flavor policy (including the peer-traversal path) and leaving other flavors untouched, and resolveDepsEntriesFromVendorCollection omitting the excluded root from both the seed and the vendor specifier map. Note: typescript-optional.spec.ts fails under nx run vite:test on main as well (passes under direct vitest), unrelated to this change.

Closes #11440.

@nx-cloud

nx-cloud Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 040b2e1

Command Status Duration Result
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-22 23:33:42 UTC

@pkg-pr-new

pkg-pr-new Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11442
npm i https://pkg.pr.new/@nativescript/vite@11442
npm i https://pkg.pr.new/@nativescript/webpack@11442

commit: 040b2e1

…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
NathanWalker force-pushed the fix/vite-flavor-vendor-exclude branch from f180e75 to 040b2e1 Compare September 22, 2026 23:32
@NathanWalker
NathanWalker merged commit d08e683 into main Sep 22, 2026
10 checks passed
@NathanWalker
NathanWalker deleted the fix/vite-flavor-vendor-exclude branch September 22, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@nativescript/vite: dev deps-bundle eagerly vendors the full octane DOM graph

1 participant