Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

esm module import with data scheme has bug with ternary operator in object #42890

Copy link
Copy link
@mghahari

Description

@mghahari
Issue body actions

Version

v16.15.0

Platform

Linux mojighahar 5.8.0-63-generic #71-Ubuntu SMP Tue Jul 13 15:59:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Running the following codes causes a SyntaxError: Unexpected end of input:

import(`data:text/javascript,
let a = {
  b: 1 == 1 ? "c" : "d";
};
`);

Or more complex:

import(`data:text/javascript,
let a = {
  b: function() { 1 == 1 ? "c" : "d"}
};
`);

But the following code works without error:

import(`data:text/javascript,
let a =  1 == 1 ? "c" : "d"
`);

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

No response

What do you see instead?

SyntaxError: Unexpected end of input
    at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:117:18)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:337:14)
    at async link (node:internal/modules/esm/module_job:70:21)

Additional information

No response

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    esmIssues and PRs related to the ECMAScript Modules implementation.Issues 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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.