Describe the bug
When package.json declares a sideEffects allowlist, vite build drops the entire body of an inline <script type="module"> in an HTML entry. Rolldown applies the package's own sideEffects: false contract to the inline script's virtual html-proxy module and prunes it wholesale — even statements with obvious side effects (document.title = ..., window.x = ..., console.log(...)).
The emitted page ends up loading only the modulepreload-polyfill helper chunk; none of the inline script survives. This worked on Vite 7 (Rollup) and regressed on Vite 8 (Rolldown).
An inline HTML script is an entry, not an importable module of the package, so the package's sideEffects declaration arguably should not govern whether its statements are kept.
Reproduction
https://stackblitz.com/edit/vitejs-vite-aw3kxbtn?file=dist%2Fassets%2Findex-Dezn_h7o.js
Steps to reproduce
npm run build
- Inspect
dist/.
Expected: the built index.html loads a chunk containing the inline script (sets document.title, window.__inlineRan, logs).
Actual: the only emitted chunk is dist/assets/index-*.js (~0.69 kB — just the modulepreload-polyfill helper). The inline script's code is gone.
Changing sideEffects to true (or removing it) makes the inline script survive, confirming the allowlist is the trigger.
System Info
System:
OS: macOS 26.5
CPU: (10) arm64 Apple M1 Pro
Memory: 113.80 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.11.1 - /Users/jonny/.nvm/versions/node/v24.11.1/bin/node
Yarn: 1.22.21 - /Users/jonny/.nvm/versions/node/v24.11.1/bin/yarn
npm: 11.6.2 - /Users/jonny/.nvm/versions/node/v24.11.1/bin/npm
pnpm: 8.15.5 - /Users/jonny/.nvm/versions/node/v24.11.1/bin/pnpm
Watchman: 2025.04.28.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 118.0.5993.117
Chrome Canary: 151.0.7875.0
Firefox: 150.0
Safari: 26.5
npmPackages:
vite: ^8.0.16 => 8.0.16
Used Package Manager
npm
Logs
No response
Validations
Describe the bug
When
package.jsondeclares asideEffectsallowlist,vite builddrops the entire body of an inline<script type="module">in an HTML entry. Rolldown applies the package's ownsideEffects: falsecontract to the inline script's virtualhtml-proxymodule and prunes it wholesale — even statements with obvious side effects (document.title = ...,window.x = ...,console.log(...)).The emitted page ends up loading only the
modulepreload-polyfillhelper chunk; none of the inline script survives. This worked on Vite 7 (Rollup) and regressed on Vite 8 (Rolldown).An inline HTML script is an entry, not an importable module of the package, so the package's
sideEffectsdeclaration arguably should not govern whether its statements are kept.Reproduction
https://stackblitz.com/edit/vitejs-vite-aw3kxbtn?file=dist%2Fassets%2Findex-Dezn_h7o.js
Steps to reproduce
npm run builddist/.Expected: the built
index.htmlloads a chunk containing the inline script (setsdocument.title,window.__inlineRan, logs).Actual: the only emitted chunk is
dist/assets/index-*.js(~0.69 kB — just themodulepreload-polyfillhelper). The inline script's code is gone.Changing
sideEffectstotrue(or removing it) makes the inline script survive, confirming the allowlist is the trigger.System Info
System: OS: macOS 26.5 CPU: (10) arm64 Apple M1 Pro Memory: 113.80 MB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 24.11.1 - /Users/jonny/.nvm/versions/node/v24.11.1/bin/node Yarn: 1.22.21 - /Users/jonny/.nvm/versions/node/v24.11.1/bin/yarn npm: 11.6.2 - /Users/jonny/.nvm/versions/node/v24.11.1/bin/npm pnpm: 8.15.5 - /Users/jonny/.nvm/versions/node/v24.11.1/bin/pnpm Watchman: 2025.04.28.00 - /opt/homebrew/bin/watchman Browsers: Chrome: 118.0.5993.117 Chrome Canary: 151.0.7875.0 Firefox: 150.0 Safari: 26.5 npmPackages: vite: ^8.0.16 => 8.0.16Used Package Manager
npm
Logs
No response
Validations