-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
36 lines (33 loc) · 920 Bytes
/
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
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(),
// .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
},
};