-
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
Should it fallback to main fields when no condition matches? #1956
Comments
Another example is "main": "dist/is-plain-object.js",
"module": "dist/is-plain-object.mjs",
"exports": {
".": {
"import": "./dist/is-plain-object.mjs",
"require": "./dist/is-plain-object.js"
},
"./package.json": "./package.json"
},
with esbuild config: require("esbuild").buildSync({
entryPoints: ["is-plain-object"],
bundle: true,
outfile: "./dist/is-plain-object.js",
format: "esm",
target: "esnext",
platform: "browser",
}); Getting error:
|
For the first one: esbuild appears to be working correctly. Nothing about For the second one: yes, perhaps esbuild should fall back to the legacy The |
Thank you @evanw for the detailed explanation! And right, adding |
I asked for clarification on the spec, and there's a pretty long thread about it here: nodejs/node#41686. It sounds like there isn't strong consensus for what to do about this from node's side, since this isn't a case that exists in node. And both Webpack and Rollup appear to always treat this case as an |
Take
tslib
as example:tslib
hasEsbuild bundles
./tslib.js
with above setting while I was expecting it to use./tslib.es6.js
as I setformat: "esm", target: "esnext"
In the case that uses
tslib
itself as entry point, shouldesbuild
use "main fields"(browser, module, main) instead of readingexports
which will then fallback toexports.default
?The text was updated successfully, but these errors were encountered: