GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — esm: exit the process with an error if loader has an issue · nodejs/node@bd82adb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/bootstrap
    • pre_execution.js
  • test/message
    • esm_loader_not_found.mjs
    • esm_loader_not_found.out
    • esm_loader_syntax_error.mjs
    • esm_loader_syntax_error.out
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/bootstrap/pre_execution.js‎

Copy file name to clipboardExpand all lines: lib/internal/bootstrap/pre_execution.js
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -480,16 +480,16 @@ function runMainESM(mainPath) {
480480
return esmLoader.initializeLoader().then(() => {
481481
const main = path.isAbsolute(mainPath) ?
482482
pathToFileURL(mainPath).href : mainPath;
483-
return esmLoader.ESMLoader.import(main).catch((e) => {
484-
if (hasUncaughtExceptionCaptureCallback()) {
485-
process._fatalException(e);
486-
return;
487-
}
488-
internalBinding('errors').triggerUncaughtException(
489-
e,
490-
true /* fromPromise */
491-
);
492-
});
483+
return esmLoader.ESMLoader.import(main);
484+
}).catch((e) => {
485+
if (hasUncaughtExceptionCaptureCallback()) {
486+
process._fatalException(e);
487+
return;
488+
}
489+
internalBinding('errors').triggerUncaughtException(
490+
e,
491+
true /* fromPromise */
492+
);
493493
});
494494
}
495495

Collapse file

‎test/message/esm_loader_not_found.mjs‎

Copy file name to clipboard
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Flags: --experimental-modules --experimental-loader i-dont-exist
2+
import '../common/index.mjs';
3+
console.log('This should not be printed');
Collapse file

‎test/message/esm_loader_not_found.out‎

Copy file name to clipboard
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
(node:*) ExperimentalWarning: The ESM module loader is experimental.
2+
(node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
3+
internal/modules/esm/default_resolve.js:*
4+
let url = moduleWrapResolve(specifier, parentURL);
5+
^
6+
7+
Error: Cannot find package 'i-dont-exist' imported from *
8+
at Loader.resolve [as _resolve] (internal/modules/esm/default_resolve.js:*:*)
9+
at Loader.resolve (internal/modules/esm/loader.js:*:*)
10+
at Loader.getModuleJob (internal/modules/esm/loader.js:*:*)
11+
at Loader.import (internal/modules/esm/loader.js:*:*)
12+
at internal/process/esm_loader.js:*:*
13+
at Object.initializeLoader (internal/process/esm_loader.js:*:*)
14+
at runMainESM (internal/bootstrap/pre_execution.js:*:*)
15+
at Function.Module.runMain (internal/modules/cjs/loader.js:*:*)
16+
at internal/main/run_main_module.js:*:* {
17+
code: 'ERR_MODULE_NOT_FOUND'
18+
}
Collapse file

‎test/message/esm_loader_syntax_error.mjs‎

Copy file name to clipboard
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Flags: --experimental-modules --experimental-loader ./test/fixtures/es-module-loaders/syntax-error.mjs
2+
import '../common/index.mjs';
3+
console.log('This should not be printed');
Collapse file

‎test/message/esm_loader_syntax_error.out‎

Copy file name to clipboard
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(node:*) ExperimentalWarning: The ESM module loader is experimental.
2+
(node:*) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
3+
file://*/test/fixtures/es-module-loaders/syntax-error.mjs:2
4+
await async () => 0;
5+
^^^^^
6+
7+
SyntaxError: Unexpected reserved word
8+
at Loader.moduleStrategy (internal/modules/esm/translators.js:*:*)
9+
at async link (internal/modules/esm/module_job.js:*:*)

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.