-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathvite.config.js
More file actions
47 lines (45 loc) · 1.22 KB
/
vite.config.js
File metadata and controls
47 lines (45 loc) · 1.22 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
42
43
44
45
46
47
import vue from '@vitejs/plugin-vue2';
import { defineConfig } from 'vite';
import { fileURLToPath } from 'url';
import { resolve } from 'path';
import { glob } from 'glob';
import dts from 'vite-plugin-dts';
const iconEntries = glob.sync('../src/icons/*.vue').reduce((entries, path) => {
const entryName = path.replace(/^\.\.\/src\/icons\/(.*)\.vue$/, 'components/icons/$1');
entries[entryName] = path;
return entries;
}, {});
const illustrationEntries = glob.sync('../src/illustrations/*.vue').reduce((entries, path) => {
const entryName = path.replace(/^\.\.\/src\/illustrations\/(.*)\.vue$/, 'components/illustrations/$1');
entries[entryName] = path;
return entries;
}, {});
export default defineConfig({
build: {
sourcemap: true,
lib: {
entry: {
...iconEntries,
...illustrationEntries,
'dialtone-icons': resolve(__dirname, '../index.js'),
},
formats: ['es', 'cjs'],
},
rolldownOptions: {
external: ['vue'],
output: {
minifyInternalExports: true,
},
},
minify: true,
},
plugins: [
vue(),
dts({ outDir: 'dist/types' }),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('../', import.meta.url)),
},
},
});