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