-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvite.config.js
More file actions
41 lines (37 loc) · 1.05 KB
/
vite.config.js
File metadata and controls
41 lines (37 loc) · 1.05 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
import { resolve } from 'path'
import { defineConfig } from 'vite'
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
const main = resolve(__dirname, 'src/main.js')
let config = {
base: '/static/',
build: {
cssCodeSplit: true,
manifest: 'manifest.json',
outDir: 'caterva2/services/static/build',
rollupOptions: {
}
},
plugins: [
]
}
if (command === 'serve') {
config.build.rollupOptions = {
input: {main}
}
}
else { // build
config.build.lib = {
entry: {main},
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;
})