Skip to content

Commit 527dac0

Browse files
authored
fix editor load in dev mode (#4)
* fix editor load in dev mode * move missing deps to peer * up versions * updated package lock * updated package lock * updated package lock
1 parent 39f630a commit 527dac0

11 files changed

Lines changed: 3819 additions & 3503 deletions

File tree

package-lock.json

Lines changed: 3763 additions & 3451 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/bootstrap/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mavonengine/create-bootstrap",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "Bootstrap a MavonEngine multiplayer project",
55
"type": "module",
66
"bin": {

packages/bootstrap/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export const TAG_URL =
2-
'https://github.com/MavonEngine/Core/archive/refs/tags/0.0.7-alpha.zip'
2+
'https://github.com/MavonEngine/Core/archive/refs/tags/0.0.8-alpha.zip'
33

44
export const TEMPLATE_SUBPATH = 'packages/multiplayer-template'

packages/core/package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@mavonengine/core",
33
"type": "module",
4-
"version": "0.0.6",
4+
"version": "0.0.7",
55
"description": "",
66
"author": "",
77
"license": "MIT",
@@ -49,11 +49,12 @@
4949
"express": "5.1.0",
5050
"three": "^0.176.0",
5151
"vite": "^6.3.5",
52-
"winston": "3.17.0"
53-
},
54-
"dependencies": {
55-
"alea": "^1.0.1"
52+
"winston": "3.17.0",
53+
"tweakpane": "^4.0.5",
54+
"@tweakpane/plugin-essentials": "^0.2.1",
55+
"three-perf": "^1.0.11"
5656
},
57+
"dependencies": {},
5758
"devDependencies": {
5859
"@dimforge/rapier3d-compat": "0.18.2",
5960
"@geckos.io/server": "^3.0.0",
@@ -62,6 +63,9 @@
6263
"@types/three": "^0.176.0",
6364
"@vitejs/plugin-react": "^5.1.2",
6465
"@vitest/coverage-v8": "^3.2.4",
66+
"tweakpane": "^4.0.5",
67+
"@tweakpane/plugin-essentials": "^0.2.1",
68+
"three-perf": "^1.0.11",
6569
"@vitest/ui": "^3.2.4",
6670
"jsdom": "^28.1.0",
6771
"three": "^0.176.0",
@@ -70,4 +74,4 @@
7074
"vite-plugin-glsl": "^1.4.1",
7175
"vitest": "^3.2.4"
7276
}
73-
}
77+
}

packages/editor/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mavonengine/editor",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "",
55
"author": "",
66
"license": "MIT",
@@ -48,7 +48,6 @@
4848
"react-resizable-panels": "^4.6.4",
4949
"react-rnd": "^10.5.2",
5050
"three-perf": "^1.0.11",
51-
"tweakpane": "^4.0.5",
5251
"wavesurfer.js": "^7.12.1"
5352
},
5453
"devDependencies": {

packages/editor/vite.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ export default defineConfig(({ command }) => ({
8989
},
9090
rollupOptions: {
9191
external: (id) => ['react', 'react-dom', 'react/jsx-runtime', 'three'].includes(id) || id.startsWith('react/') || id.startsWith('@mavonengine/core') || id.startsWith(coreRoot),
92+
plugins: [
93+
{
94+
name: 'inject-css-into-mount-chunk',
95+
generateBundle(_, bundle) {
96+
const cssFile = Object.keys(bundle).find(k => k.endsWith('.css'))
97+
// Inject into the dynamic mount chunk so CSS only loads when new Editor() is called
98+
const mountChunk = Object.values(bundle).find(chunk => chunk.type === 'chunk' && chunk.isDynamicEntry)
99+
if (cssFile && mountChunk)
100+
mountChunk.code = `import './${cssFile}';\n${mountChunk.code}`
101+
},
102+
},
103+
],
92104
},
93105
},
94106
test: {

packages/multiplayer-template/client/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
},
1717
"devDependencies": {
1818
"@vitejs/plugin-vue": "^5.2.4",
19+
"react": "^19.1.0",
20+
"react-dom": "^19.1.0",
1921
"three": "^0.176.0",
2022
"typescript": "5.9.2",
2123
"vite": "^6.3.5",

packages/multiplayer-template/client/src/main.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import type { App } from 'vue'
22
import RAPIER from '@dimforge/rapier3d-compat'
33
import Game from '@mavonengine/core/Game'
4-
import Editor from '@mavonengine/editor'
54
import { createApp } from 'vue'
65
import GameWorld from './Scenes/GameWorld'
76
import Frame from './UI/Frame.vue'
87
import './game.css'
98

10-
Game.devModeHook = () => Editor.registerListener()
9+
if (import.meta.env.DEV) {
10+
Game.devModeHook = () => {
11+
import('@mavonengine/editor').then(({ default: Editor }) => Editor.registerListener())
12+
}
13+
}
1114

1215
RAPIER.init().then(() => {
1316
const physicsWorld = new RAPIER.World({ x: 0, y: -9.83, z: 0 })

packages/multiplayer-template/client/vite.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ export default {
6262
...(existsSync(coreSrc) ? { '@mavonengine/core': coreSrc } : {}),
6363
'@template/server': resolve(templateRoot, 'server/src'),
6464
},
65-
dedupe: ['@mavonengine/core', 'three', 'vue', '@dimforge/rapier3d-compat'],
65+
dedupe: ['@mavonengine/core', 'three', 'vue', 'react', 'react-dom', '@dimforge/rapier3d-compat'],
6666
},
6767
}

packages/multiplayer-template/package-lock.json

Lines changed: 20 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)