-
Notifications
You must be signed in to change notification settings - Fork 24
/
vite.config.js
47 lines (45 loc) · 1.02 KB
/
vite.config.js
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 { defineConfig } from 'vite'
import * as path from 'node:path'
import react from '@vitejs/plugin-react'
// import visualizer from 'rollup-plugin-visualizer'
const entries = ['./src/index.ts']
export default defineConfig({
root: process.argv[2] ? undefined : 'demo',
resolve: {
alias: {
'r3f-perf': path.resolve(__dirname, './src'),
},
},
server: {
port: 4000,
open: true
},
build: {
minify: false,
sourcemap: true,
target: 'es2018',
lib: {
formats: ['es', 'cjs'],
entry: entries[0],
fileName: '[name]',
},
rollupOptions: {
// plugins: [
// visualizer({
// emitFile: false,
// open: true,
// sourcemap: true
// }),
// ],
external: (id) => !id.startsWith('.') && !path.isAbsolute(id),
treeshake: false,
input: entries,
output: {
preserveModules: true,
preserveModulesRoot: 'src',
sourcemapExcludeSources: true,
},
},
},
plugins: [react()],
})