-
-
Notifications
You must be signed in to change notification settings - Fork 353
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
Configure module resolution condition in developement mode #1930
Comments
I believe that all meta-frameworks should configure the conditions like this. Some already do. So by doing that the tool can make sure that it behaves like the rest of the ecosystem, thus making it easier for the users. It's especially true in this situation because a part of the overall app already has those conditions enabled, so not enabling them for the other part is going to be confusing for people |
Thanks for reaching out and that makes a lot of sense 👍
Do you know how they do it? Because I ain't aware of a simple way. |
I've done short research and now I'm not sure how many metaframeworks do this already. Many are but to a great extent they might rely on bundling the server code. In such a scenario, the resolution algorithm is offloaded to a bundler and both app-level code and node_modules code is loaded using the same conditions. If you want to keep loading some modules using node itself then I think you might have 2 options:
Note that the problem itself is not isolated to |
It seems that we can make it work, except of one blocking issue: the user would need to set all resolve conditions when he calls Alternatively, spawning a child process in production would do the trick but I wonder whether it could break certain production Node.js environments? For example docker?
Do you have an example of how to use Also, there is the environment variable
Remix only passes |
Hello @brillout,
At least Next does. Here is what we get with the same test case in Next App Router: Here is the repo if you want to test: https://github.com/garronej/next-dual-package-repro-repo |
Description
Hello Vike team,
First of all, congratulations on what you’re building!
I wanted to bring to your attention a potential issue with the Vike development server configuration, which could lead to a "dual package" scenario during development. By "dual package," I mean instances where different distributions of the same module are loaded simultaneously. This can cause problems, particularly for modules that are used as peer dependencies, such as those exposing a React context provider.
To help illustrate the issue, I’ve created a reproduction repository:
https://github.com/garronej/vike-dual-package-repo-repo
As per @Andarist's analysis, this issue could potentially be resolved on your side by passing the
--conditions=development
flag to Node.js. You can review his explanation here.This issue is currently affecting users implementing tss-react in Vike, and likely other modules that rely on
@emotion/react
as a peer dependency.Thanks a lot for taking the time to review this!
Best,
References:
The text was updated successfully, but these errors were encountered: