[Bug]: Wrong location of __mf__virtual in monorepo #254
Labels
bug
Something isn't working
COMMUNITY: PR is welcomed
We think it's a good feature to have but would love for the community to help with the PR for it
good first issue
Good for newcomers
Describe the bug
My repository is a monorepo,and the project structure is roughly:
server
is used to create a vite service and dynamically start different vite applications based on the access route.When @module-federation/vite creates __mf__virtual, it looks for
node_modules
based onprocess.cwd()
vite/src/utils/VirtualModule.ts
Lines 6 to 15 in 7ccebc8
In this case, __mf__virtual will be placed in the
node_modules
of theserver
directory, not thenode_modules
in the packages, leading to potential conflictsIs it a more reasonable solution to look for
node_modules
based onroot
of vite.config instead ofprocess.cwd()
Version
v6.0.6
Reproduction
https://codesandbox.io/p/github/Xeikim/mf-monorepo/main?import=true
Relevant log output
Validations
The text was updated successfully, but these errors were encountered: