-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
49 lines (46 loc) · 1.07 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
43
44
45
46
47
48
49
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
const path = require('path')
const fs = require('fs')
function stripDevCSS () {
return {
name: 'strip-dev-css',
resolveId (source) {
return source === 'virtual-module' ? source : null
},
renderStart (outputOptions, _inputOptions) {
const outDir = outputOptions.dir
const cssDir = path.resolve(outDir, 'css')
fs.rm(cssDir, { recursive: true }, () => console.log(`Deleted ${cssDir}`))
}
}
}
// https://vitejs.dev/config/
// noinspection JSUnusedGlobalSymbols
export default defineConfig({
server: {
port: 4000,
strictPort: true
},
build: {
lib: {
entry: path.resolve(__dirname, 'src/main.js'),
name: 'GALC',
filename: (fmt) => `galc.${fmt}.js`
},
minify: false,
rollupOptions: {
external: (id) => id.startsWith('/css/')
},
sourcemap: true
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
},
plugins: [vue(), stripDevCSS()],
define: {
'process.env': process.env
}
})