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
Conversation
Copy link
Copy Markdown
PR Checklist
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 passed
npx 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
Labels
None yet
1 participant