-
Notifications
You must be signed in to change notification settings - Fork 12
/
vite.config.ts
58 lines (57 loc) · 1.49 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
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
import { defineConfig } from 'vite'
import { resolve } from 'path'
import { viteStaticCopy } from 'vite-plugin-static-copy'
export default defineConfig({
envPrefix: 'SPLOOT_',
server: {
port: 3000,
strictPort: true,
},
publicDir: 'public',
plugins: [
viteStaticCopy({
targets: [{ src: resolve(__dirname, 'node_modules', 'structured-pyright', 'dist', 'static'), dest: '' }],
}),
tsconfigPaths(),
react({
babel: {
configFile: true,
},
}),
{
name: 'configure-response-headers',
configureServer: (server) => {
server.middlewares.use((_req, res, next) => {
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp')
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin')
res.setHeader('Cross-Origin-Resource-Policy', 'same-origin')
next()
})
},
},
],
optimizeDeps: {
include: ['@chakra-ui/react', '@chakra-ui/icons'],
},
build: {
rollupOptions: {
output: {
manualChunks: {
chakra: [
'@chakra-ui/react',
'@chakra-ui/icons',
'@emotion/react',
'@emotion/styled',
'focus-visible',
'framer-motion',
],
pyright: ['structured-pyright'],
editor: ['@splootcode/editor'],
python: ['@splootcode/language-python'],
},
},
},
},
})