From ef61169d00e9689bbc89d1582ceb4ab757d66f4d Mon Sep 17 00:00:00 2001 From: Evan Wallace Date: Mon, 28 Dec 2020 19:38:22 -0800 Subject: [PATCH] fix #626: "import.meta" is supported in node 10.4+ --- CHANGELOG.md | 6 ++++++ internal/compat/js_table.go | 1 + scripts/compat-table.js | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51c562e362d..637d187751b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +* Mark `import.meta` as supported in node 10.4+ ([#626](https://github.com/evanw/esbuild/issues/626)) + + It was previously marked as unsupported due to a typo in esbuild's compatibility table, which meant esbuild generated a shim for `import.meta` even when it's not necessary. It should now be marked as supported in node 10.4 and above so the shim will no longer be included when using a sufficiently new target environment such as `--target=node10.4`. + ## 0.8.26 * Ensure the current working directory remains unique per `startService()` call diff --git a/internal/compat/js_table.go b/internal/compat/js_table.go index 63a557601f0..280f87085ac 100644 --- a/internal/compat/js_table.go +++ b/internal/compat/js_table.go @@ -238,6 +238,7 @@ var jsTable = map[JSFeature]map[Engine][]int{ ES: {2020}, Firefox: {62}, IOS: {12}, + Node: {10, 4}, Safari: {11, 1}, }, Let: { diff --git a/scripts/compat-table.js b/scripts/compat-table.js index 899148d0895..4159dd37ab8 100644 --- a/scripts/compat-table.js +++ b/scripts/compat-table.js @@ -151,7 +151,7 @@ mergeVersions('ImportMeta', { es2020: true, firefox62: true, ios12: true, - node10_4: false, // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import.meta + node10_4: true, // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import.meta safari11_1: true, })