Skip to content

[Bug]: update Expression transform into wrong result in cjs #14340

@magic-akari

Description

@magic-akari

💻

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

REPL

export let foo = 1n;

foo++;

Configuration file name

No response

Configuration

No response

Current and expected behavior

exports.foo = void 0;

var _foo;

let foo = 1n;
exports.foo = foo;
_foo = +foo, exports.foo = foo = _foo + 1, _foo;

Note: cannot mix bigint with number.

Environment

default config

Possible solution

++foo
=> exports.foo = ++foo

bar++
=> (ref = bar++, exports.bar = bar, ref)

Additional context

No response

Metadata

Metadata

Assignees

Labels

outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions