Skip to content

[fix] preserve isolation of minified require bundles - #40

Merged
mwasiluk merged 1 commit into
SilverDecisions:modernizefrom
mwasiluk:fix/minified-bundle-isolation
Nov 4, 2026
Merged

mwasiluk merged 1 commit into
SilverDecisions:modernizefrom
mwasiluk:fix/minified-bundle-isolation

Conversation

@mwasiluk

@mwasiluk mwasiluk commented Nov 4, 2026

Copy link
Copy Markdown
Member

@rollup/plugin-terser defaults to toplevel: true for the cjs output. The minified module bundle then starts with top-level vars that hold the require wrapper's cache and factories, so a second minified module bundle in the same scope overwrote them (Maximum call stack size exceeded, r is not a function). Terser now runs with toplevel: false; plain and standalone files are unchanged.

bundle-isolation.test.js (module targets) checks the added globals, the exports and cache after another require bundle is loaded, the require chain before and after the bundle, MODULE_NOT_FOUND and lazy evaluation.

@rollup/plugin-terser defaults to toplevel: true for the cjs output. The minified
module bundle then starts with top-level vars that hold the require wrapper's
cache and factories, so a second minified module bundle in the same scope
overwrote them (Maximum call stack size exceeded, r is not a function).
Terser now runs with toplevel: false; plain and standalone files are unchanged.

bundle-isolation.test.js (module targets) checks the added globals, the exports
and cache after another require bundle is loaded, the require chain before and
after the bundle, MODULE_NOT_FOUND and lazy evaluation.
@mwasiluk
mwasiluk merged commit f0c06b1 into SilverDecisions:modernize Nov 4, 2026
4 checks passed
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.

2 participants