-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
52 lines (51 loc) · 1.27 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
50
51
52
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { visualizer } from 'rollup-plugin-visualizer';
import crypto from 'crypto';
export default defineConfig({
plugins: [vue(), visualizer()],
build: {
lib: {
entry: {
zoa: 'src/main.js',
},
name: 'Zoa',
formats: ['es'],
},
rollupOptions: {
external: [
'vue',
'@fortawesome/vue-fontawesome@latest-3',
'@fortawesome/fontawesome-svg-core',
'@fortawesome/free-solid-svg-icons',
'@fortawesome/free-brands-svg-icons',
],
output: {
globals: { vue: 'Vue' },
entryFileNames: 'zoa.js',
},
},
},
define: {
'process.env': process.env,
},
css: {
modules: {
generateScopedName: (name, filename, css) => {
let componentName;
// prefer using the component name, but fall back to hash if that
// doesn't work
try {
componentName = filename.split('/').pop().split('.')[0].toLowerCase();
} catch {
componentName = crypto
.createHash('md5')
.update(css)
.digest('base64')
.substring(0, 5);
}
return `zoa__${componentName}__${name}`;
},
},
},
});