Skip to content

Instantly share code, notes, and snippets.

@excavador
Created August 27, 2026 17:45
Show Gist options
  • Select an option

  • Save excavador/e7a862dba1a9ac132c9ba28ee2f5bba7 to your computer and use it in GitHub Desktop.

Select an option

Save excavador/e7a862dba1a9ac132c9ba28ee2f5bba7 to your computer and use it in GitHub Desktop.
rollup 4.63.0 tree-shaking regression: rxjs side-effect modules dropped, awaited promise never settles

rollup 4.63.0 regression: side-effectful rxjs modules tree-shaken away

Minimal reproduction for a tree-shaking regression introduced in rollup 4.63.0.

Run

npm install   # package.json pins rollup 4.63.0 via overrides
npx vite build
node dist/index.js

With "overrides": {"rollup": "4.63.0"} (as committed): the awaited lastValueFrom(...) promise never settles — node prints "Warning: Detected unsettled top-level await" and exits with code 13.

Change the override to "rollup": "4.62.5", reinstall, rebuild: prints RESULT: 2 and exits 0.

What gets dropped

Diffing the sourcemap sources between the two builds, 4.63.0 removes these side-effectful rxjs-internal modules that 4.62.5 keeps:

  • rxjs/dist/cjs/internal/util/errorContext.js
  • rxjs/dist/cjs/internal/NotificationFactories.js
  • rxjs/dist/cjs/internal/scheduler/timeoutProvider.js

Reproduces with build.minify: false as well, so esbuild minification is not involved. rxjs is consumed through @rollup/plugin-commonjs (the cjsExports wrapper) via vite's default pipeline.

import { of, lastValueFrom } from 'rxjs';
import { map } from 'rxjs/operators';
const value = await lastValueFrom(of(1).pipe(map((x) => x + 1)));
console.log('RESULT:', value);
{
"name": "rollup-4630-rxjs-repro",
"private": true,
"type": "module",
"dependencies": {
"rxjs": "^7.8.2",
"vite": "^7.3.0"
},
"overrides": {
"rollup": "4.63.0"
}
}
import { defineConfig } from 'vite';
export default defineConfig({
resolve: { conditions: ['module', 'node'], mainFields: ['module'] },
esbuild: { keepNames: true },
build: {
minify: false,
sourcemap: true,
lib: { entry: { index: './entry.js' }, formats: ['es'] },
rollupOptions: { external: [] },
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment