fix(vite): preserve external HMR module identities by sanketpatel32 · Pull Request #11728 · NativeScript/NativeScript
Repository navigation
fix(vite): preserve external HMR module identities - #11728
Open
sanketpatel32 wants to merge 1 commit into NativeScript:main from sanketpatel32:devin/1796356341-fix-vite-hmr-graph-id
Open
fix(vite): preserve external HMR module identities #11728 sanketpatel32 wants to merge 1 commit into NativeScript:main from sanketpatel32:devin/1796356341-fix-vite-hmr-graph-id
Conversation
sanketpatel32 commented Dec 4, 2026
Copy link Copy Markdown
PR Checklist
- The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/main/tools/notes/CONTRIBUTING.md#commit-messages .
- There is an issue for the bug/feature this PR is for. To avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it.
- You have read and signed the CLA (first-time contributors can sign directly on the PR by commenting
I have read the CLA and I hereby sign the CLA). - All existing tests are passing: https://github.com/NativeScript/NativeScript/blob/main/tools/notes/DevelopmentWorkflow.md#unit-testing .
- Tests for the changes are included - https://github.com/NativeScript/NativeScript/blob/main/tools/notes/WritingUnitTests.md .
What is the current behavior?
HmrModuleGraph.normalizeGraphId strips the plugin-root prefix and then truncates any remaining path at the first app-root segment. A native module such as /workspace/native/src/screen.tsx and an external shared module such as /workspace/shared/src/screen.tsx therefore both become /src/screen.tsx, so the second registration replaces the first graph entry.
What is the new behavior?
Only absolute paths beneath the plugin root's configured app directory are normalized to the app virtual root. Paths outside that directory retain their filesystem or root-relative identity, keeping distinct native and shared modules distinct in the graph. A regression spec registers same-named files from both locations and asserts that two graph entries remain.
Verification:
npx nx run vite:test-- 169 files, 1968 tests passednpx nx run vite:lint-- 0 errors (22 pre-existing warnings)npx prettier --write packages/vite/hmr/server/hmr-module-graph.ts packages/vite/hmr/server/hmr-module-graph.spec.ts
Fixes #11569
fix(vite): preserve external HMR module identities
9d9518b
Only normalize absolute paths beneath the configured app directory to the app virtual root. Paths outside that root keep their filesystem or root-relative identity so same-named native and shared modules remain distinct graph entries. Fixes NativeScript#11569
This branch has not been deployed
No deployments
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment