-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
42 lines (40 loc) · 1.49 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
35
36
37
38
39
40
41
42
// this is the build config for this demo library source, not the playground
// the build config for the library playground (document) is located at docs/vite.config.ts
import { resolve } from 'path';
import { defineConfig } from 'vite';
import typescript from '@rollup/plugin-typescript';
export default defineConfig({
build: {
// use vite library mode to build the package
// https://vitejs.dev/guide/build.html#library-mode
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'ReactSelectMediaDevicesModal',
// the proper extensions will be added
fileName: 'react-select-media-devices-modal',
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ['react'],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
react: 'React',
},
},
},
},
plugins: [
// use @rollup/plugin-typescript to generate .d.ts files
// https://github.com/rollup/plugins/tree/master/packages/typescript#noforceemit
typescript({
declaration: true,
emitDeclarationOnly: true,
noForceEmit: true,
declarationDir: resolve(__dirname, 'dist/types'),
rootDir: resolve(__dirname, 'src'),
}),
],
});