You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, plugin automatically sets react, and runtimes into optimizeDeps.include.
When react is externalized during development (and for example, provided through import maps) this behavior is unwanted and results in various warnings / errors.
Is there a possibility that this behavior could be made opt-in, or something similar?
One of the common use cases is when utilizing microfrontends architecture, where all microfrontends consume the same version of "react", for example, provided through import maps — to avoid issues with multiple instances of react.
Yeah as you encounter this kind of need (micro-frontend, module federation, multiple dev server in dev, ...) is not supported by Vite today. I think @yyx990803 wants that to be better supported in the revamp with Rolldown, but until I'm not personally willing to add support for these feature requests that feels like Conway's low for me.
As already mentioned in multiple other issues, Vite is really flexible as soon as your keep one dev server, and you can have an index.html with <div id="app1"></div><div id="app1"></div> and an index.tsx with import "../../app1/src/index.tsx"; import "../../app2/src/index.tsx"; that will boot both apps.
Anyway, if really you want to go forward with this separation of dev-servers, you can inject a plugin that does something like:
Describe the bug
Currently, plugin automatically sets react, and runtimes into optimizeDeps.include.
When react is externalized during development (and for example, provided through import maps) this behavior is unwanted and results in various warnings / errors.
Is there a possibility that this behavior could be made opt-in, or something similar?
Reproduction
Not relevant
Steps to reproduce
No response
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: