Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Connot compile optional chaining when the word eval is present inside the file. #926

@bytemuck

Description

@bytemuck

using esm version 3.2.25
with node v16.19.1

let s = "a string"; // a comment with the word eval

let x = {
    a: "b"
}

console.log(x?.a);

does not compile.

let s = "eval"; // a comment without the e word

let x = {
    a: "b"
}

console.log(x?.a);

does not compile.

the error is

console.log(x?.a);
              ^

SyntaxError: Invalid or unexpected token
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)

but when I dont put eval anywhere, it compiles fine

i use node -r esm file.js to run the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions