-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.js
38 lines (38 loc) · 1.03 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
import { glob } from 'glob';
import path from 'path';
import { defineConfig } from 'vite';
import FullReload from 'vite-plugin-full-reload';
import injectHTML from 'vite-plugin-html-inject';
export default defineConfig(({ command }) => {
return {
define: {
[command === 'serve' ? 'global' : '_global']: {},
},
root: 'src',
publicDir: '../public',
build: {
sourcemap: true,
rollupOptions: {
input: glob.sync('./src/*.html'),
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
return 'vendor';
}
},
entryFileNames: 'commonHelpers.js',
},
},
outDir: '../dist',
minify: 'esbuild',
},
plugins: [injectHTML(), FullReload(['./src/**/**.html'])],
resolve: {
alias: {
'@public': path.resolve(__dirname, './public'),
'@partials': path.resolve(__dirname, './src/partials'),
'@assets': new URL('./src/assets', import.meta.url).pathname,
},
},
};
});