-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
42 lines (38 loc) · 1.08 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
39
40
41
42
import { resolve } from 'path'
import { defineConfig } from 'vite'
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
const admin = resolve(__dirname, 'src/admin.js')
const front = resolve(__dirname, 'src/front.js')
let config = {
base: '/static/',
build: {
cssCodeSplit: true,
manifest: "manifest.json",
outDir: 'var/build',
rollupOptions: {
}
},
plugins: [
]
}
if (command === 'serve') {
config.build.rollupOptions = {
input: {admin}
}
}
else { // build
config.build.lib = {
entry: {admin},
formats: ['es'],
fileName: (format, entryName) => `${entryName}.js`,
}
// In lib mode filenames don't include a hash by default, add one here
config.build.rollupOptions.output = {
entryFileNames: '[name]-[hash].js',
assetFileNames: '[name]-[hash][extname]',
}
}
//console.log('CONFIG', config)
return config
})