Skip to content

Stop the editor's published bundle breaking in the browser - #39

Merged
mattvb91 merged 1 commit into
devfrom
fix/editor-dist-bundle
Nov 12, 2026
Merged

mattvb91 merged 1 commit into
devfrom
fix/editor-dist-bundle

Conversation

@mattvb91

Copy link
Copy Markdown
Member

react-dom/client wasn't external, so the editor bundled react-dom as CommonJS and rolldown left require("react") calls in it. Browsers have no require, so the editor's UI failed to load in installed projects. three's addons were bundled too, giving the game and the editor separate copies of classes like TransformControls. Both are external now.

The template aliases core and the editor to their src/, so neither local dev nor CI ever loaded dist/. The editor build now fails when a chunk bundles a peer dependency or calls require() at runtime, and a new e2e runs the template against the built packages (MAVONENGINE_USE_DIST=1) and opens the editor in Chrome.

react-dom/client wasn't external, so the editor bundled react-dom as
CommonJS and rolldown left require("react") calls in it. Browsers have
no require, so the editor's UI failed to load in installed projects.
three's addons were bundled too, giving the game and the editor separate
copies of classes like TransformControls. Both are external now.

The template aliases core and the editor to their src/, so neither local
dev nor CI ever loaded dist/. The editor build now fails when a chunk
bundles a peer dependency or calls require() at runtime, and a new e2e
runs the template against the built packages (MAVONENGINE_USE_DIST=1)
and opens the editor in Chrome.
@mattvb91
mattvb91 merged commit 3b07bd4 into dev Nov 12, 2026
2 checks passed
@mattvb91
mattvb91 deleted the fix/editor-dist-bundle branch November 12, 2026 17:00
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