-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
32 lines (30 loc) · 931 Bytes
/
vite.config.js
File metadata and controls
32 lines (30 loc) · 931 Bytes
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
import { resolve } from 'path';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import pkg from './package.json' with { type: 'json' }
// Version of the config in which dependencies are not bundled (to use as a npm dependency).
// https://vitejs.dev/guide/build.html#library-mode
export default defineConfig({
build: {
lib: {
entry: resolve('./src/index.ts'),
name: pkg.displayName,
},
rollupOptions: {
external: [
...Object.keys(pkg.dependencies), // don't bundle dependencies
/^node:.*/, // don't bundle built-in Node.js modules (use protocol imports!)
],
output: {
globals: {
'three': 'THREE',
'd3': 'd3',
'd3-scale-chromatic': 'd3ScaleChromatic',
'camera-controls': 'CameraControls'
}
}
},
target: 'esnext', // transpile as little as possible
},
plugins: [dts()],
});