Reproduction link or steps
TinyMCE + Vite 8 (Rolldown) - Module Execution Order Bug
vite-rolldown-problem-2.zip
Issue Description
When multiple files independently import tinymce/tinymce, Rolldown incorrectly orders module execution in production builds. Side-effect imports (tinymce/models/dom) execute before the main tinymce module is initialized, causing ReferenceError: tinymce is not defined.
Reproduction Steps
-
Install dependencies:
-
Run development mode (WORKS):
- Open browser → No errors
- TinyMCE initializes correctly
-
Build for production (FAILS):
- Open browser console
- ERROR:
Uncaught ReferenceError: tinymce is not defined
- Error occurs in bundled
models/dom module
Root Cause
The bug is triggered by Shared Chunk Extraction in Rolldown:
- Multiple entry points (10 modules) import the same wrapper.
- Rolldown extracts TinyMCE into a shared chunk (e.g.,
assets/utils-[hash].js).
- Inside this shared chunk, the module order is corrupted:
models/dom is wrapped as an IIFE and executed immediately: })))();
tinymce/tinymce is wrapped as a lazy CJS module and not yet executed.
- Immediate execution fails because
tinymce global is missing.
Verification of Bug (Manual)
If for some reason the browser console doesn't show the error immediately, you can verify the bug by inspecting the generated code:
- Look in
dist/assets/ for the large shared chunk (e.g., utils-v9yuU6bo.js).
- Search for the string
})))();.
- You will find it at the end of the
models/dom module region.
- Note that the main
tinymce module nearby ends with })); (lazy) while models/dom ends with })))(); (immediate). This is the bug.
Workaround
Add to vite.config.ts:
export default {
build: {
rollupOptions: {
output: {
strictExecutionOrder: true, // Forces correct module order
},
},
},
};
What is expected?
To work like vite 7
What is actually happening?
It fails
System Info
System:
OS: macOS 15.7.4
CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
Memory: 1022.98 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.14.0 - /Users/doberkofler/.nvm/versions/node/v24.14.0/bin/node
npm: 11.11.1 - /Users/doberkofler/.nvm/versions/node/v24.14.0/bin/npm
pnpm: 10.32.1 - /usr/local/bin/pnpm
bun: 1.2.19 - /Users/doberkofler/.bun/bin/bun
Watchman: 2026.03.09.00 - /usr/local/bin/watchman
Browsers:
Chrome: 146.0.7680.153
Safari: 26.3.1
Any additional comments?
No response
Reproduction link or steps
TinyMCE + Vite 8 (Rolldown) - Module Execution Order Bug
vite-rolldown-problem-2.zip
Issue Description
When multiple files independently import
tinymce/tinymce, Rolldown incorrectly orders module execution in production builds. Side-effect imports (tinymce/models/dom) execute before the maintinymcemodule is initialized, causingReferenceError: tinymce is not defined.Reproduction Steps
Install dependencies:
Run development mode (WORKS):
Build for production (FAILS):
Uncaught ReferenceError: tinymce is not definedmodels/dommoduleRoot Cause
The bug is triggered by Shared Chunk Extraction in Rolldown:
assets/utils-[hash].js).models/domis wrapped as an IIFE and executed immediately:})))();tinymce/tinymceis wrapped as a lazy CJS module and not yet executed.tinymceglobal is missing.Verification of Bug (Manual)
If for some reason the browser console doesn't show the error immediately, you can verify the bug by inspecting the generated code:
dist/assets/for the large shared chunk (e.g.,utils-v9yuU6bo.js).})))();.models/dommodule region.tinymcemodule nearby ends with}));(lazy) whilemodels/domends with})))();(immediate). This is the bug.Workaround
Add to
vite.config.ts:What is expected?
To work like vite 7
What is actually happening?
It fails
System Info
System: OS: macOS 15.7.4 CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz Memory: 1022.98 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 24.14.0 - /Users/doberkofler/.nvm/versions/node/v24.14.0/bin/node npm: 11.11.1 - /Users/doberkofler/.nvm/versions/node/v24.14.0/bin/npm pnpm: 10.32.1 - /usr/local/bin/pnpm bun: 1.2.19 - /Users/doberkofler/.bun/bin/bun Watchman: 2026.03.09.00 - /usr/local/bin/watchman Browsers: Chrome: 146.0.7680.153 Safari: 26.3.1Any additional comments?
No response