-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathvite.config.js
More file actions
40 lines (38 loc) · 974 Bytes
/
vite.config.js
File metadata and controls
40 lines (38 loc) · 974 Bytes
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
import { defineConfig } from 'vite';
import { fileURLToPath } from 'url';
import dts from 'vite-plugin-dts';
import { glob } from 'glob';
const themeEntries = glob.sync('./themes/*.js').reduce((entries, path) => {
entries[path.replace('.js', '')] = path;
return entries;
}, {});
const postcssEntries = glob.sync('./postcss/*.js').reduce((entries, path) => {
entries[path.replace('.js', '')] = path;
return entries;
}, {});
// https://vitejs.dev/config/
export default defineConfig({
build: {
emptyOutDir: false,
lib: {
entry: {
...postcssEntries,
...themeEntries,
},
formats: ['es', 'cjs'],
},
rolldownOptions: {
output: {
minifyInternalExports: true,
chunkFileNames: () => 'themes/chunks/[name]-[hash].js',
},
},
minify: true,
},
resolve: {
alias: {
'@': fileURLToPath(new URL('.', import.meta.url)),
},
},
plugins: [dts({ outDir: 'dist/types' })],
});