diff options
author | Guy Bedford <guybedford@gmail.com> | 2019-09-28 15:01:23 -0400 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-10-08 21:18:04 -0700 |
commit | c0437d2633fb523fbc97deb3f1731bbefa4a2e90 (patch) | |
tree | 853bac233e5c0b27ae7b8ccd92585c5667dfd4b7 /lib | |
parent | cbd8d715b2286e5726e6988921f5c870cbf74127 (diff) | |
download | android-node-v8-c0437d2633fb523fbc97deb3f1731bbefa4a2e90.tar.gz android-node-v8-c0437d2633fb523fbc97deb3f1731bbefa4a2e90.tar.bz2 android-node-v8-c0437d2633fb523fbc97deb3f1731bbefa4a2e90.zip |
Revert "esm: remove experimental status from JSON modules"
This reverts commit ec8776da6fa77628e12718bb38cee687303d4137.
PR-URL: https://github.com/nodejs/node/pull/29754
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/modules/esm/default_resolve.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/internal/modules/esm/default_resolve.js b/lib/internal/modules/esm/default_resolve.js index 580419deac..7686e3e003 100644 --- a/lib/internal/modules/esm/default_resolve.js +++ b/lib/internal/modules/esm/default_resolve.js @@ -8,6 +8,7 @@ const { getOptionValue } = require('internal/options'); const preserveSymlinks = getOptionValue('--preserve-symlinks'); const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); +const experimentalJsonModules = getOptionValue('--experimental-json-modules'); const typeFlag = getOptionValue('--input-type'); const experimentalWasmModules = getOptionValue('--experimental-wasm-modules'); const { resolve: moduleWrapResolve, @@ -28,7 +29,6 @@ const extensionFormatMap = { '__proto__': null, '.cjs': 'commonjs', '.js': 'module', - '.json': 'json', '.mjs': 'module' }; @@ -36,7 +36,7 @@ const legacyExtensionFormatMap = { '__proto__': null, '.cjs': 'commonjs', '.js': 'commonjs', - '.json': 'json', + '.json': 'commonjs', '.mjs': 'module', '.node': 'commonjs' }; @@ -44,6 +44,9 @@ const legacyExtensionFormatMap = { if (experimentalWasmModules) extensionFormatMap['.wasm'] = legacyExtensionFormatMap['.wasm'] = 'wasm'; +if (experimentalJsonModules) + extensionFormatMap['.json'] = legacyExtensionFormatMap['.json'] = 'json'; + function resolve(specifier, parentURL) { try { const parsed = new URL(specifier); |