Skip to content

fix(vite): emit the Android activity chunk under a stable name - #11539

Merged
NathanWalker merged 2 commits into
mainfrom
fix/vite-stable-activity-chunk
Oct 21, 2026
Merged

NathanWalker merged 2 commits into
mainfrom
fix/vite-stable-activity-chunk

Conversation

@triniwiz

Copy link
Copy Markdown
Member

PR Checklist

What is the current behavior?

The Android activity chunk is emitted as activity.android-[hash].mjs, and that name is baked into the generated Java activity at native build time. After a rebuild that changes the hash, Java still loads the old chunk, which is still on the device and imports vendor exports that no longer exist: the app crashes with "isEmbedded is not a function".

What is the new behavior?

chunkFileNames moves into helpers/chunk-file-names.ts, and the activity.android chunk is named [name].mjs. Vendor, worker and other chunk names are unchanged.

Tests: helpers/chunk-file-names.spec.ts runs a real build twice with different activity source and asserts activity.android.mjs both times (on main the name is hashed).

Each new test fails without the change. The @nativescript/vite suite (163 files) and tsc -p tsconfig.lib.json pass on the branch.

Core's Android activity is imported dynamically, so the build emits it as
its own chunk, `activity.android-[hash].mjs`. The static binding generator
writes that path into the generated Java activity at native build time. A
rebuild that changed the hash left Java loading the previous build's chunk,
still on the device, against the new vendor chunk, and the app crashed at
launch with "isEmbedded is not a function".

The activity chunk is now named `activity.android.mjs`, so its path stays
the same across rebuilds. Other chunks keep their names.
@nx-cloud

nx-cloud Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit cbb83d3

Command Status Duration Result
nx run-many -t build -p core,webpack5,vite ✅ Succeeded 1s View ↗

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


☁️ Nx Cloud last updated this comment at 2026-10-15 20:34:26 UTC

@pkg-pr-new

pkg-pr-new Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: cbb83d3

@NathanWalker
NathanWalker merged commit cdc141b into main Oct 21, 2026
10 checks passed
@NathanWalker
NathanWalker deleted the fix/vite-stable-activity-chunk branch October 21, 2026 18:38
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.

2 participants