summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/internal/process/esm_loader.js6
-rw-r--r--test/es-module/test-esm-dynamic-import.js3
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/internal/process/esm_loader.js b/lib/internal/process/esm_loader.js
index 19099d9cbd..404be77338 100644
--- a/lib/internal/process/esm_loader.js
+++ b/lib/internal/process/esm_loader.js
@@ -24,6 +24,12 @@ exports.initializeImportMetaObject = function(wrap, meta) {
exports.importModuleDynamicallyCallback = async function(wrap, specifier) {
assert(calledInitialize === true || !userLoader);
+ if (!calledInitialize) {
+ process.emitWarning(
+ 'The ESM module loader is experimental.',
+ 'ExperimentalWarning', undefined);
+ calledInitialize = true;
+ }
const { callbackMap } = internalBinding('module_wrap');
if (callbackMap.has(wrap)) {
const { importModuleDynamically } = callbackMap.get(wrap);
diff --git a/test/es-module/test-esm-dynamic-import.js b/test/es-module/test-esm-dynamic-import.js
index 8a92ac41ed..1fc22f1d98 100644
--- a/test/es-module/test-esm-dynamic-import.js
+++ b/test/es-module/test-esm-dynamic-import.js
@@ -42,6 +42,9 @@ function expectFsNamespace(result) {
// For direct use of import expressions inside of CJS or ES modules, including
// via eval, all kinds of specifiers should work without issue.
(function testScriptOrModuleImport() {
+ common.expectWarning('ExperimentalWarning',
+ 'The ESM module loader is experimental.');
+
// Importing another file, both direct & via eval
// expectOkNamespace(import(relativePath));
expectOkNamespace(eval(`import("${relativePath}")`));