Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nx requiring additional vite config #186

Open
DanielSegal1 opened this issue Nov 18, 2024 · 2 comments
Open

nx requiring additional vite config #186

DanielSegal1 opened this issue Nov 18, 2024 · 2 comments

Comments

@DanielSegal1
Copy link

DanielSegal1 commented Nov 18, 2024

Hi, in the past few days I tried to use the plugin inside my app which is part of an NX monorepo.
Unfortunately I got 404 when trying to fetch ..../monorepo/node_modules/__mf__virtual/remote_app_H_A_I_hostAutoInit_H_A_I.js (I cant remember the exact name but it was close to that).

Fiddling around, I realized that because this is an NX monorepo, and the node_modules are located under the whole monorepo and not under the app (where it usually would be), vite doesn't expose it.

I tried some workarounds, and what I found to be working is adding to the vite's config:
build: { fs: { allow: ['..../monorepo/node_modules'] } }

My takeaway from this journey is that it either should be solved Inside the plugin itself, or if thats beyond the capabilities, at least add this bit of information to the docs.
Would like to hear what you think about it

P.S this app is pretty big with quite a few dependecies (one of the currently is @originjs/vite-plugin-federation) and we've never had this kind of problem

@gioboa
Copy link
Collaborator

gioboa commented Nov 18, 2024

@DanielSegal1 thanks for your investigation.
We definitely need to add a note in the readme file. I prefer to inform the end user rather than try to cover all the possible configurations. Your case is Nx, but another one is Turborepo, etc. etc.
Can I ask you to open a PR for that? Thanks

@zhangHongEn
Copy link
Contributor

Have you set base and server.origin?

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

No branches or pull requests

3 participants