-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
43 lines (39 loc) · 1.08 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
import react from '@vitejs/plugin-react'
import { transformWithEsbuild } from 'vite'
import glsl from 'vite-plugin-glsl'
export default {
root: 'src/',
publicDir: '../public/',
base: './',
plugins:
[
// React support
react(),
// glsl support
glsl(),
// .js file support as if it was JSX
{
name: 'load+transform-js-files-as-jsx',
async transform(code, id)
{
if (!id.match(/src\/.*\.js$/))
return null
return transformWithEsbuild(code, id, {
loader: 'jsx',
jsx: 'automatic',
});
},
},
],
server:
{
host: true, // Open to local network and display URL
open: !('SANDBOX_URL' in process.env || 'CODESANDBOX_HOST' in process.env) // Open if it's not a CodeSandbox
},
build:
{
outDir: '../dist', // Output in the dist/ folder
emptyOutDir: true, // Empty the folder first
sourcemap: true // Add sourcemap
},
}