-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Open
Labels
esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.
Description
module.exports;
await 1;The above code snippet causes an ERR_AMBIGUOUS_MODULE_SYNTAX error, since module.exports cannot be used (CJS) in an ESM file. However, the error logged to the console, shown below, incorrectly assumes the error stems from the use of a require()
ReferenceError: Cannot determine intended module format because both require() and top-level await are present. If the code is intended to be CommonJS, wrap await in an async function. If the code is intended to be an ES module, replace require() with import.
idango10
Metadata
Metadata
Assignees
Labels
esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.