-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
vite.config.mts
executable file
·46 lines (41 loc) · 942 Bytes
/
vite.config.mts
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
import {resolve} from 'path';
import { defineConfig } from 'vite';
import dts from "vite-plugin-dts";
import strip from "vite-plugin-strip-comments";
import { name } from './package.json';
const getPackageName = () => {
return name.includes('@') ? name.split('/')[1] : name;
};
const NAME = 'Navbar';
const fileName = {
es: `${getPackageName()}.mjs`,
cjs: `${getPackageName()}.cjs`,
iife: `${getPackageName()}.js`,
};
export default defineConfig({
base: './',
resolve: {
alias: {
"~": resolve(__dirname, "src"),
},
},
plugins: [
dts({
outDir: 'dist/js',
copyDtsFiles: true,
rollupTypes: true,
}),
strip(),
],
build: {
emptyOutDir: true,
outDir: 'dist/js',
lib: {
entry: resolve(__dirname, 'src/ts/index.ts'),
name: NAME,
formats: ['es', 'cjs', 'iife'],
fileName: (format: string) => fileName[format],
},
sourcemap: true,
}
});