-
Notifications
You must be signed in to change notification settings - Fork 9
/
vite.config.mts
34 lines (33 loc) · 988 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
import { defineConfig } from 'vite'
import checker from 'vite-plugin-checker'
import dts from 'vite-plugin-dts'
import react from '@vitejs/plugin-react-swc'
import { nodeExternals } from 'rollup-plugin-node-externals'
import preserveDirectives from 'rollup-plugin-preserve-directives'
export default defineConfig({
build: {
target: 'es6',
outDir: 'lib',
lib: {
entry: ['src/index.ts'],
fileName: (format, entryName) =>
format === 'es' ? `${entryName}.mjs` : `${entryName}.js`,
formats: ['es', 'cjs'],
},
rollupOptions: {
plugins: [nodeExternals()],
output: {
interop: 'auto',
preserveModules: true,
preserveModulesRoot: 'src',
},
},
minify: false,
},
plugins: [
checker({ typescript: { tsconfigPath: './tsconfig.build.json' } }),
dts({ tsconfigPath: './tsconfig.build.json' }),
react({ plugins: [['@swc/plugin-styled-components', {}]] }),
preserveDirectives(),
],
})