Open ex37 opened 5 months ago
As is mentioned in the documentation you linked to, this behavior was deliberately copied from Webpack. I'd like to keep the behavior consistent with Webpack so packages can standardize on some behavior instead of adding to the confusion by having the ecosystem fragment further.
@evanw while I agree with you on standardizing behavior, there are still older and not so frequently maintained packages in the wild, so at least having a possibility to force certain behavior using plugins or configuration options would be really helpful, otherwise the only solution is to manually patch packages. And if you are not so interested in this, maybe you'll welcome a PR?
I have some complaints about the way of choosing either Node or Babel interpretation, which is described here: https://esbuild.github.io/content-types/#default-interop
I have a typescript front end app, which is sort of a monorepo, and is divided into packages. Packages are using
"type": "module"
in their package.json files', and I use it for the exports / imports functionality together withresolvePackageJsonExports
typescript flag.The code is definitely not intended to run in Node, in fact platform is set to
browser
in esbuild's config, but cause of the way it's currently interpreted, it causes problems when importing different front end libraries.What I suggest is either of the following:
.mjs
/.mts
files, i.e. ignoretype: "module"
Thanks.