-
Notifications
You must be signed in to change notification settings - Fork 35
/
vite.config.js
48 lines (41 loc) · 1008 Bytes
/
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
import path from 'path'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import handlebars from 'vite-plugin-handlebars';
/** @type {import('vite').UserConfig} */
export const alias = {
'@': path.resolve(__dirname, 'src'),
'#': path.resolve(__dirname),
}
export const polyfill = nodePolyfills({
// Whether to polyfill specific globals.
protocolImports: true,
globals: {
Buffer: true,
global: true,
process: true,
}
})
export const build = {
target: 'esnext',
chunkSizeWarningLimit: 1600,
rollupOptions: {
entryFileNames: '[name].js',
chunkFileNames: '[name].js',
plugins: [polyfill]
},
}
export const plugins = (script) => ([
react(),
handlebars({ context: { script } }),
polyfill
])
// https://vitejs.dev/config/
export default defineConfig({
build,
root: 'src/renderer',
envPrefix: 'WATCHIT_',
resolve: { alias },
plugins: plugins('index.web.jsx'),
})