-
Notifications
You must be signed in to change notification settings - Fork 710
Labels
Description
Reproduction link or steps
- Open https://stackblitz.com/edit/github-nci4o6nk-yfztxytw?file=rolldown.config.mjs,package.json,src%2Fread.js
pnpm iruns automaticallypnpm run buildruns automatically- Run
node src/index.js - Run
node dist/index.js
What is expected?
node dist/index.js behaves the same with node src/index.js.
In other words, node dist/index.js outputs:
read foo
read foo
What is actually happening?
node dist/index.js behaves differently from node src/index.js.
In other words, node dist/index.js outputs:
read undefined
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: 20.19.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@rolldown/browser: 1.0.0-beta.9-commit.273d50eAny additional comments?
The plugin marks files other than index.js / setup.js as sideeffect free. If I do not mark read.js as sideeffect free, the output is correct. Even in that case, if I wrap globalThis.foo with a pure annotated IIFE, the output is wrong.
I think the missing limitation that should apply here is: "a side-effect-free module that may depend on a side-effectful module should not be reordered."
refs #4617
Reactions are currently unavailable