-
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
Incorrect import()
range for Node matrix
#1772
Comments
target
is overriding format
valueimport()
range for Node matrix
Test these Node versions for dynamic import support:
Warning disappears @ 12.20 |
I see that this isn't the first time this has been raised, and in the past it was left as Node 13.2 because "Node version 12 is no longer active." But that's not true according to Node's LTS schedule: It's v13 that's no longer actively being maintained by Node (nor v15!), not v12, because v12 still has maintenance LTS status through April 2022. (You can also see this reflected in the version support matrix for AWS Lambda.) I'd bet that it's much more likely for a version of Node 12 to still be out in the wild than Node 13. To me that's an argument for considering 12.20 the true (or at least most useful) beginning of dynamic import support. There were only three releases of Node 13 that didn't support it:
Node 12 had 34:
Because it's not possible to have support start and stop across major versions, IMO |
I think this is a two-part issue.
For starters, I have this as for my config:
And then here's a basic example file:
Ran this in Node 12.20+ (tested
12.22.7
), which means I havetarget: "node12.22.7"
active.The first problem here is that esbuild's internal matrix thinks that this version (and presumably all 12.20+) doesn't support
import()
, but it does.The second is that because esbuild thinks
node12.22.7
doesn't supportimport()
, it gets rewritten into arequire
statement, even though it's still exporting ESM syntax:If I go through and hardcode a
target: 'es2015'
(or later), then it'll work as expected:So the TLDR for the 2nd issue here is that
format
isn't applying to dynamic imports, which allows an output targeting ESM to (unknowingly) includerequire
statements.The text was updated successfully, but these errors were encountered: