Replace invalid ddeleteOriginalAssets with deleteOriginalAssets: false so vite-plugin-compression2 keeps uncompressed JS/CSS alongside .gz files. Without this, index.html referenced missing chunks and the scene failed to load. Rebuild MenuScene and SampleScene production bundles. Made-with: Cursor
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
import { defineConfig } from 'vite';
|
|
import viteCompression from 'vite-plugin-compression2';
|
|
import basicSsl from '@vitejs/plugin-basic-ssl'
|
|
|
|
export default defineConfig(async ({ command }) => {
|
|
|
|
const { needlePlugins, useGzip, loadConfig } = await import("@needle-tools/engine/plugins/vite/index.js");
|
|
const needleConfig = await loadConfig();
|
|
|
|
return {
|
|
base: "./",
|
|
plugins: [
|
|
basicSsl(),
|
|
useGzip(needleConfig)
|
|
? viteCompression({ deleteOriginalAssets: false, algorithms: ["gzip"] })
|
|
: null,
|
|
needlePlugins(command, needleConfig),
|
|
],
|
|
server: {
|
|
https: true,
|
|
proxy: { // workaround: specifying a proxy skips HTTP2 which is currently problematic in Vite since it causes session memory timeouts.
|
|
'https://localhost:3000': 'https://localhost:3000'
|
|
},
|
|
strictPort: true,
|
|
port: 3000,
|
|
},
|
|
build: {
|
|
outDir: "./dist",
|
|
emptyOutDir: true,
|
|
}
|
|
}
|
|
}); |