30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
import { defineConfig } from 'vite';
|
|
import viteCompression from 'vite-plugin-compression';
|
|
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({ deleteOriginFile: true, verbose: false }) : 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,
|
|
}
|
|
}
|
|
}); |