Skip to content

[Bug]: inlining constants in CJS by optimization.inlineConst breaks the code #6080

@sapphi-red

Description

@sapphi-red

Reproduction link or steps

REPL

What is expected?

The output to be like:

//#region index.js
var import_react = /* @__PURE__ */ __toESM(require_react());
const foo = "1.0.0".startsWith("1");
console.log(foo);

//#endregion

What is actually happening?

The output is:

//#region index.js
var import_react = /* @__PURE__ */ __toESM(require_react());
const foo = "1.0.0"("1");
console.log(foo);

//#endregion

(.startsWith is removed incorrectly)

System Info

REPL 1.0.0-beta.36

Any additional comments?

No response

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions