/
vite.config.js
40 lines (38 loc) 路 1.01 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
import path from 'path'
import react from '@vitejs/plugin-react'
import ssl from '@vitejs/plugin-basic-ssl'
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin'
import { defineConfig } from 'vite'
const config = {
serve: defineConfig({
assetsInclude: ['**/*.hdr', '**/*.gltf'],
root: 'examples',
plugins: [react(), ssl(), vanillaExtractPlugin()],
server: { host: '0.0.0.0', https: true },
resolve: {
alias: {
'@react-three/xr': path.resolve(process.cwd(), 'src')
}
}
}),
build: defineConfig({
build: {
minify: false,
sourcemap: true,
target: 'es2018',
lib: {
formats: ['es', 'cjs'],
entry: 'src/index.tsx',
fileName: '[name]'
},
rollupOptions: {
external: (id) => !id.startsWith('.') && !path.isAbsolute(id),
output: {
preserveModules: true,
sourcemapExcludeSources: true
}
}
}
})
}
export default defineConfig(({ command }) => config[command])