Skip to content

errors with --experimental-loader trigger unhandled rejections in core #30205

Closed
@targos

Description

@targos
$ node --experimental-modules --experimental-loader i-dont-exist test.mjs
(node:480349) ExperimentalWarning: The ESM module loader is experimental.
(node:480349) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(node:480349) UnhandledPromiseRejectionWarning: Error: Cannot find package 'i-dont-exist' imported from /home/mzasso/test/m/
    at Loader.resolve [as _resolve] (internal/modules/esm/default_resolve.js:84:13)
    at Loader.resolve (internal/modules/esm/loader.js:74:33)
    at Loader.getModuleJob (internal/modules/esm/loader.js:148:40)
    at Loader.import (internal/modules/esm/loader.js:132:28)
    at internal/process/esm_loader.js:60:31
    at Object.initializeLoader (internal/process/esm_loader.js:64:5)
    at runMainESM (internal/bootstrap/pre_execution.js:480:20)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1049:5)
    at internal/main/run_main_module.js:16:11
(node:480349) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:480349) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
$ node --experimental-modules --experimental-loader ./i-have-syntax-error.mjs test.mjs
(node:480438) ExperimentalWarning: The ESM module loader is experimental.
(node:480438) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(node:480438) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected end of input
    at Loader.moduleStrategy (internal/modules/esm/translators.js:84:18)
    at async link (internal/modules/esm/module_job.js:36:21)
(node:480438) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:480438) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.esmIssues and PRs related to the ECMAScript Modules implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions