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

Browser Main Fields override Export Conditions #1307

Closed
ryansolid opened this issue Oct 3, 2022 · 1 comment
Closed

Browser Main Fields override Export Conditions #1307

ryansolid opened this issue Oct 3, 2022 · 1 comment

Comments

@ryansolid
Copy link

ryansolid commented Oct 3, 2022

Expected Behavior

When an export condition matches it doesn't use the "browser" main field to remap it just because "browser" was set.

Actual Behavior

In our case it matches on "worker" and then gets upgraded to the "browser" version unexpectedly.

Additional Information

solidjs/solid-start#263 Lays out the issue. It is talking about Vite. And I will take it up with them as well but it seems like this behavior originated by decisions taken by rollup.

This issue isn't only unexpected but it makes things very difficult. We have 3 things trying to balance:

  1. Server vs Browser runtimes are different for SolidJS
  2. Cloudflare Worker environments are Server environments for us but most tools call them browser, understandably because of Service/Web Workers. That's ok we can control this with export conditions.
  3. Browser mainfield support is necessary for legacy tooling support. But its existence causes the work we do to map workers to be undone.

All these seem unmoveable. But perhaps main field overriding export conditions is not.

@shellscape
Copy link
Collaborator

Thanks for opening an issue. Citing the issue template:

🚨 Issues WITHOUT a valid reproduction WILL BE CLOSED!

Please provide one by:

  1. Using the REPL.it plugin reproduction template at https://repl.it/@rollup/rollup-plugin-repro
  2. Provide a minimal repository link (Read https://git.io/fNzHA for instructions).
    Please use NPM for installing dependencies!
    These may take more time to triage than the other options.
  3. Using the Rollup REPL at https://rollupjs.org/repl/

⚠️ ZIP Files are unsafe and maintainers will NOT download them.

We cannot make this any clearer. Please add a reproduction and we'll be happy to triage further.

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

2 participants