-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
59 lines (56 loc) · 1.53 KB
/
vite.config.ts
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
53
54
55
56
57
58
59
/* eslint-disable node/prefer-global/process */
import path from 'node:path'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import glsl from 'vite-plugin-glsl'
const isCodeSandbox
= 'SANDBOX_URL' in process.env || 'CODESANDBOX_HOST' in process.env
// https://vitejs.dev/config/
export default defineConfig({
base: './',
publicDir: './public',
assetsInclude: ['**/*.glb', '**/*.hdr', '**/*.mp3', '**/*.ico'],
resolve: {
alias: {
'@': path.resolve(__dirname, './src/'),
'@textures': path.resolve(__dirname, './static/textures/'),
'@models': path.resolve(__dirname, './static/models/'),
'@images': path.resolve(__dirname, './static/images/'),
'@audios': path.resolve(__dirname, './static/audios/'),
'@utils': path.resolve(__dirname, './src/utils/'),
},
},
server: {
host: true,
open: !isCodeSandbox, // Open if it's not a CodeSandbox
port: 2333,
},
plugins: [
glsl({
compress: true,
watch: true,
}),
react(),
],
build: {
rollupOptions: {
output: {
manualChunks: {
react: ['react', 'react-dom'],
gsap: ['gsap', '@gsap/react'],
three: ['three'],
r3f: [
'@react-three/fiber',
'@react-three/drei',
'r3f-perf',
],
chunk: ['leva', '@wtto00/jweixin-esm', 'dingtalk-jsapi'],
pp: ['@react-three/postprocessing', 'postprocessing'],
},
},
},
},
esbuild: {
drop: ['console', 'debugger'],
},
})