Skip to content

[v4] Invalid variable name generated when importing from UTF-8 with BOM file #5162

@sapphi-red

Description

@sapphi-red

Rollup Version

4.0.0-23

Operating System (or Browser)

Windows

Node Version (if applicable)

18.17.1

Link To Reproduction

https://github.com/sapphi-red-repros/rollup-bom-invalid-variable-name-generated

Expected Behaviour

The generated code is valid.

const msg$1g = 'foo;'

// import from a utf-8 bom file
const msg = 'foo';
console.log(msg, msg$1);

Actual Behaviour

The generated code is invalid.

constmsg$1g = 'foo;'

// import from a utf-8 bom file
const msg = 'foo';
console.log(msg, msg$1);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions