-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
🐛 BUG: esbuild will incorrectly disregard exports
if browser
/module
/main
are defined.
#2952
Comments
exports
if browser
/module
/main
are defined.
exports
if browser
/module
/main
are defined.exports
if browser
/module
/main
are defined.
I believe node's new module resolution algorithm that handles
The problem is that you have a You should remove the |
@evanw okay, will try that now |
@evanw so brilliant news, that fixed it. What strange behaviour. I've updated my actual project to change |
Ran into this against the daet and start-of-week packages.
I've setup a proof of failure repo at:
https://github.com/balupton/astro-cfpages-esbuild-resolution-bug
Which is using:
The only way to get it to correctly use the
workerd
import is to change it to:Which is a removal of these:
Which would drop support for things like browserify and older node versions - which @bevry has been supporting successfully for its hundreds of packages (half a billion installs a month) for a very long time, by using boundation and editions to ensure the correct environment always loads the best edition for it.
The solution is to prefer
exports
over the legacy fields, which is what Node.js does. The ideal would be to support editions, however since @bevry's proposal and successful implementation in 2016, the industry has continued doing its own thing, so my hopes for wider adoption of Editions has been wishful thinking. The current behaviour (preferring legacy fields overexports
) means the @bevry suite of packages do not function as intended for esbuild users, which is a significant impact, and having @bevry conform to the esbuild behaviour would have a far more significant negative impact as it would break our seamless support for legacy node and other bundlers.Cross-posted at cloudflare/workers-sdk#2805
The text was updated successfully, but these errors were encountered: