Skip to content

Commit 2416fa4

Browse files
committed
Adding a preview command
Upgrading wa-map-optimizer-vite to 1.2.5 to fix a module loading issue
1 parent 04203ec commit 2416fa4

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ To test how your map will behave in production:
128128
# Build the optimized production version for your map
129129
npm run buildmap
130130

131+
# Serve the generated dist/ directory with CORS headers
132+
npm run preview
133+
131134
```
132135

133136
This will:
@@ -181,6 +184,7 @@ For more details, read [the WorkAdventure upload documentation](https://docs.wor
181184
|---------|-------------|
182185
| `npm run dev` | Start Vite development server with hot reload |
183186
| `npm run buildmap` | Build only the map files (without frontend) |
187+
| `npm run preview` | Serve the generated `dist/` directory with CORS headers after `npm run buildmap` |
184188
| `npm run upload` | Build and upload map to WA Map Storage |
185189
| `npm run upload-only` | Upload map without rebuilding (requires existing build) |
186190

buildmap.vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ export default defineConfig({
3131
},
3232
},
3333
},
34+
preview: {
35+
cors: true,
36+
},
3437
plugins: [
3538
...getMapsOptimizers(maps, optimizerOptions),
3639
],

package-lock.json

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"start": "npm run dev",
88
"dev": "vite --config web.vite.config.ts",
99
"buildmap": "tsc && vite build --config buildmap.vite.config.ts",
10+
"preview": "vite preview --config buildmap.vite.config.ts --outDir dist",
1011
"upload": "npm run buildmap && upload-wa-map",
1112
"upload-only": "upload-wa-map"
1213
},
@@ -26,6 +27,6 @@
2627
"dependencies": {
2728
"@workadventure/map-starter-kit-core": "^1.1.5",
2829
"@workadventure/scripting-api-extra": "^1.9.10",
29-
"wa-map-optimizer-vite": "^1.2.4"
30+
"wa-map-optimizer-vite": "^1.2.5"
3031
}
3132
}

0 commit comments

Comments
 (0)