Remove @babylonjs/gui-editor dependency and mark as external#427
Remove @babylonjs/gui-editor dependency and mark as external#427tracygardner wants to merge 4 commits intomainfrom
Conversation
It is only a transitive dependency of @babylonjs/inspector (a devDependency) and is not used directly by the application. Removing it from dependencies and marking it as a Rollup external prevents it from inflating the bundle. https://claude.ai/code/session_01W3JSg9Nh34J36sZj9FnkdJ
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughRemoved Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
vite.config.mjs (1)
1-305:⚠️ Potential issue | 🟡 MinorPrettier check is failing for this file in CI.
Pipeline reports a formatting issue in
vite.config.mjs; please run Prettier and commit the formatted file to unblock checks.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@vite.config.mjs` around lines 1 - 305, Prettier formatting is failing for vite.config.mjs; reformat the file with your project's Prettier settings (e.g., run prettier --write vite.config.mjs or npm/yarn format) and commit the changes so CI passes; ensure the exported default config (export default { ... }), plugin blocks (cssInjectedByJsPlugin, VitePWA, viteStaticCopy), and the custom writeBundle hooks (create-flock-proxy, copy-library-files) remain functionally unchanged after formatting.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@vite.config.mjs`:
- Around line 1-305: Prettier formatting is failing for vite.config.mjs;
reformat the file with your project's Prettier settings (e.g., run prettier
--write vite.config.mjs or npm/yarn format) and commit the changes so CI passes;
ensure the exported default config (export default { ... }), plugin blocks
(cssInjectedByJsPlugin, VitePWA, viteStaticCopy), and the custom writeBundle
hooks (create-flock-proxy, copy-library-files) remain functionally unchanged
after formatting.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f3376272-53ff-4b3c-a693-a50d45b4fe4e
📒 Files selected for processing (2)
package.jsonvite.config.mjs
💤 Files with no reviewable changes (1)
- package.json
The Rollup external only covers the build phase; Vite's esbuild pre-bundler also needs to be told to skip these packages. Without this, esbuild fails when processing the inspector bundle which has a hardcoded require() for @babylonjs/gui-editor. https://claude.ai/code/session_01W3JSg9Nh34J36sZj9FnkdJ
The inspector bundle is CommonJS and must be pre-bundled by esbuild so it can run in the browser. Excluding it caused Vite to serve the raw CJS bundle directly, breaking all its require() calls and cascading into ERR_FAILED errors for @babylonjs/gui files. @babylonjs/gui-editor alone in the exclude list is enough: Vite passes excluded entries as esbuild externals, so the inspector is pre-bundled with gui-editor left as an unresolved external reference. https://claude.ai/code/session_01W3JSg9Nh34J36sZj9FnkdJ
The inspector's CJS bundle has a hardcoded require() for it, so it must be installed locally for the dev server to resolve. As a devDependency it is installed during development but excluded from the production bundle via rollupOptions.external and optimizeDeps.exclude. https://claude.ai/code/session_01W3JSg9Nh34J36sZj9FnkdJ
Summary
This PR removes the
@babylonjs/gui-editorpackage as a direct dependency and marks it as an external module in the Rollup build configuration. This change indicates the package is no longer bundled with the application.Changes
@babylonjs/gui-editorfrom package.json dependencies@babylonjs/gui-editorto theexternalarray in Rollup'srollupOptionsconfiguration to prevent bundling attemptsImplementation Details
By marking the package as external in Rollup, any imports of
@babylonjs/gui-editorwill be treated as external dependencies rather than being bundled into the final build output. This is useful when the package is either:https://claude.ai/code/session_01W3JSg9Nh34J36sZj9FnkdJ
Summary by CodeRabbit