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

target: node>12 supports import.meta.url but esbuild says is not available in the configured environment. #626

Closed
SalvatorePreviti opened this issue Dec 28, 2020 · 1 comment

Comments

@SalvatorePreviti
Copy link
Contributor

SalvatorePreviti commented Dec 28, 2020

NodeJS > 12 supports natively import.meta.url but setting it as a target generates an empty meta.url.

Warning is "import.meta" is not available in the configured target environment and will be empty

Forcefully setting the target to "es2020" causes instead other 2020 syntax to fail in node 12, 13, 14 like, for example, null coalescing operators.

Solution: esbuild with target node>12 should use the native import.meta.url

@evanw
Copy link
Owner

evanw commented Dec 29, 2020

Thanks for the report. I think this is just due to a typo in esbuild's compatibility table:

node10_4: false, // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import.meta

This should be true, not false. Will fix.

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

Successfully merging a pull request may close this issue.

2 participants