Skip to content

Add plugin that declares side-effects#21449

Open
NullVoxPopuli wants to merge 2 commits into
mainfrom
nvp/reconfigure-rollup
Open

Add plugin that declares side-effects#21449
NullVoxPopuli wants to merge 2 commits into
mainfrom
nvp/reconfigure-rollup

Conversation

@NullVoxPopuli

@NullVoxPopuli NullVoxPopuli commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

explicit side-effect listing is a pain in the butt to manage by hand, so let's do it automatically!

This list of side-effects will get smaller as my further PRs do refactoring to fix how many files end up with side-effects -- I want to try to refactor side-effecting modules to as few things as possible so we get better tree-shake-ability

the way I've been thinking about this is:

  • if we don't import 1 file, does anything break?
    • yes: side effect present,
    • no: can be fully omitted,

what gave the hello-world app the biggest gains in this PR was declaring @ember/component as side-effect free

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

📊 Size report

Tarball size1.2 MB1.2 MB

dist/dev   -0%↓

File Before (Size / Brotli) After (Size / Brotli)
./packages/shared-chunks/api-{hash}.js 24.8 kB / 5.4 kB -59.3%↓10.1 kB / -58.4%↓2.3 kB
./packages/shared-chunks/cache-{hash}.js 17.9 kB / 4.8 kB -96.1%↓697 B / -94.6%↓258 B
Total (Includes all files) 2.1 MB / 491.9 kB -0%↓2.1 MB / 0%↑491.9 kB

dist/prod   -0%↓

File Before (Size / Brotli) After (Size / Brotli)
./packages/shared-chunks/cache-{hash}.js 9.9 kB / 2.8 kB -93%↓697 B / -90.8%↓258 B
Total (Includes all files) 1.9 MB / 450 kB -0%↓1.9 MB / -0.02%↓449.9 kB

smoke-tests/v2-app-template/dist   0.06%↑

File Before (Size / Brotli) After (Size / Brotli)
./assets/main-{hash}.js 312.4 kB / 83.6 kB -1.78%↓306.8 kB / -1.63%↓82.2 kB
./assets/modules-{hash}.js 33.9 kB / 10.2 kB 17%↑39.6 kB / 17%↑11.9 kB
Total (Includes all files) 347.8 kB / 94.5 kB 0.06%↑348 kB / 0.4%↑94.9 kB

smoke-tests/v2-app-hello-world-template/dist   -8.08%↓

File Before (Size / Brotli) After (Size / Brotli)
./assets/main-{hash}.js 158.7 kB / 43.6 kB -8.09%↓145.9 kB / -7.15%↓40.5 kB
Total (Includes all files) 159.1 kB / 43.8 kB -8.08%↓146.2 kB / -7.12%↓40.7 kB

🤖 This report was automatically generated by wyvox/pkg-size

@NullVoxPopuli NullVoxPopuli force-pushed the nvp/reconfigure-rollup branch 2 times, most recently from 6db88ae to 3b9abe5 Compare June 8, 2026 17:30
Comment thread rollup.config.mjs Outdated
async function hasNoSideEffects(file) {
let bundle;
try {
bundle = await rollup({

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

running rollup in rollup is a little silly, but it turns out that this is ultimately what agadoo does -- I don't want to remove that yet -- but if this rollup plugin proves reliable and changes to the sideEffects output in package.json match that in the agadoo, I'll remove the agadoo stuff

Update sideEffects list

Declare that we don't do propertyReadSideEffects
@NullVoxPopuli NullVoxPopuli force-pushed the nvp/reconfigure-rollup branch from 47c4a67 to 52e1155 Compare June 11, 2026 19:51
//////////

export const COMPUTE: TagComputeSymbol = Symbol('TAG_COMPUTE') as TagComputeSymbol;
Reflect.set(globalThis, 'COMPUTE_SYMBOL', COMPUTE);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a side-effect, but is never read by anything

…ing the sideEffects list

More

Automatically annotate things we think are probably safe when generating the sideEffects list

Automatically annotate things we think are probably safe when generating the sideEffects list

Automatically annotate things we think are probably safe when generating the sideEffects list

Automatically annotate things we think are probably safe when generating the sideEffects list
@NullVoxPopuli NullVoxPopuli force-pushed the nvp/reconfigure-rollup branch from 0bcc758 to 4a06c42 Compare June 11, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant