Skip to content

Cannot add property 0, object is not extensible #5770

@natew

Description

@natew

Rollup Version

4.29.0

Operating System (or Browser)

Mac

Node Version (if applicable)

No response

Link To Reproduction

https://github.com/natew/rollup-bug

Expected Behaviour

To repro:

git clone git@github.com:natew/rollup-bug.git
cd rollup-bug
yarn
yarn dev
curl http://127.0.0.1:8081/index.bundle\?platform\=ios > ~/tmp/out.js

You'll see an error:

CleanShot 2024-12-20 at 13 24 46@2x

Actual Behaviour

Error:

    at Array.push (<anonymous>)
    at LogicalExpression.getLiteralValueAtPath (file:///private/tmp/s2/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:13090:53)
    at IfStatement.getTestValue (file:///private/tmp/s2/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:12054:77)
    at IfStatement.include (file:///private/tmp/s2/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:11991:36)

This is due to:

this.expressionsToBeDeoptimized.push(origin);

note that this.expressionsToBeDeoptimized.push is set like:

this.expressionsToBeDeoptimized = EMPTY_ARRAY;

and EMPTY_ARRAY has Object.freeze(), so it's not mutable.

This started happening only in 4.29

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions