-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
71 lines (63 loc) · 1.58 KB
/
vite.config.ts
File metadata and controls
71 lines (63 loc) · 1.58 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
import path from 'path'
import { fileURLToPath } from 'url'
import { defineConfig } from 'vite'
import legacy from '@vitejs/plugin-legacy'
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
import ViteYaml from '@modyfi/vite-plugin-yaml'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
export default defineConfig({
base: '/js/',
plugins: [
nodePolyfills(),
legacy({
targets: ['defaults', 'not IE 11'],
}),
viteCommonjs(),
ViteYaml(),
],
build: {
chunkSizeWarningLimit: 600,
rollupOptions: {
input: {
app: path.resolve(__dirname, 'src/client/main.ts'),
landingpage: path.resolve(__dirname, 'src/client/landingpage.ts'),
shared: path.resolve(__dirname, 'src/client/shared.ts'),
},
output: {
entryFileNames: '[name].js',
chunkFileNames: '[name].js',
assetFileNames: '[name].[ext]',
},
},
outDir: 'public/js',
emptyOutDir: false,
assetsDir: '',
},
publicDir: false,
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
path: 'path-browserify',
stream: 'stream-browserify',
},
},
define: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
global: 'globalThis',
},
server: {
port: 3001,
proxy: {
'/api': {
target: 'http://localhost:3000',
changeOrigin: true,
},
},
},
worker: {
format: 'es',
plugins: () => [nodePolyfills()],
},
})