-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
52 lines (47 loc) · 1.64 KB
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import * as path from 'path';
import { defineConfig } from 'vite';
import viteCompression from 'vite-plugin-compression';
import react from '@vitejs/plugin-react';
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: "./",
assetsInclude: ['*'],
plugins: [
react(),
basicSsl(),
useGzip(needleConfig) && !process.env.CI ? viteCompression({ deleteOriginFile: true }) : 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'
},
watch: {
awaitWriteFinish: {
stabilityThreshold: 500,
pollInterval: 1000
},
},
strictPort: true,
port: 3000
},
build: {
outDir: "./dist",
emptyOutDir: true,
keepNames: true,
},
resolve: {
alias: {
'react': () => path.resolve(__dirname, 'node_modules/react'),
'@react-three/fiber': () => path.resolve(__dirname, 'node_modules/@react-three/fiber'),
}
},
optimizeDeps: {
exclude: ["@needle-tools/engine"]
}
}
});