Skip to content

Syntax errors are misattributed to ModuleRequest.js:33:13 #21100

@qwertie

Description

@qwertie
  • Version: v8.11.1
  • Platform: Win7 64-bit
  • Subsystem: --experimental-modules

If a module refers to another module with a syntax error, e.g.

// script.mjs
import * as module from './module';
// module.mjs
export default function parse(csv, reviver) {
},

export function stringify(table, replacer) {
}

Node claims that the syntax error is within Node.js itself:

>node --experimental-modules "script.mjs"
(node:8428) ExperimentalWarning: The ESM module loader is experimental.
SyntaxError: Unexpected token ,
    at ModuleJob.loaders.set [as moduleProvider] (internal/loader/ModuleRequest.js:33:13)
    at <anonymous>

Metadata

Metadata

Assignees

No one assigned

    Labels

    errorsIssues and PRs related to JavaScript errors originated in Node.js core.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