-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
34 lines (32 loc) · 1.03 KB
/
vite.config.ts
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
// @ts-ignore Not sure how to solve this but not worth the time to figure it out...
import * as packageJson from './package.json';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
export default defineConfig({
plugins: [
react({
// Not really required but seems to make the bundle a bit smaller
jsxRuntime: 'classic',
}),
dts({
include: ['src/**/*'],
}),
],
build: {
lib: {
entry: resolve(__dirname, 'src', 'index.ts'),
formats: ['es'],
fileName: 'index',
},
rollupOptions: {
// Do not include the deps and peerDeps in the build.
external: [...Object.keys(packageJson.peerDependencies || {}), ...Object.keys(packageJson.dependencies)],
// `preserveModules` makes the lib tree shakable (in combination with `sideEffects: false` in `package.json`).
output: { preserveModules: true, exports: 'named' },
},
target: 'esnext',
sourcemap: true,
},
});