Skip to content

[Bug]: rolldown does not treat builtin object constructors like new Map as sideeffect free #2603

@sapphi-red

Description

@sapphi-red

Reproduction link or steps

  1. Open https://stackblitz.com/edit/github-xv4yss-xwr4ef?file=src%2Fentry.js,package.json
  2. npm i runs automatically
  3. npm run build runs automatically
  4. See dist/entry.js (not empty)
  5. run npm run build:up to use rollup
  6. See dist/entry.js (empty)

What is expected?

Builtin object constructors like new Map are treated as sideeffect free like rollup does and the output gets empty.

What is actually happening?

The output is not empty.

System Info

Stackblitz

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    rolldown: https://pkg.pr.new/rolldown@829d80a => 0.13.2

Any additional comments?

Found while trying to bundle Vite with Rolldown.

The code where rollup defines the sideeffects for each builtin functions / objects are written in https://github.com/sapphi-red/rollup/blob/master/src/ast/nodes/shared/knownGlobals.ts

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions