-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathvite.config.js
46 lines (43 loc) · 1.34 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
const path = require("path");
const root = path.join(__dirname, "./playground_src");
module.exports = ({ mode }) => {
return {
root,
base: mode === "development" ? "/" : "/try/",
// Load styles and stuff from the root of the website
publicDir: mode === "development" ? path.join(root, "..") : undefined,
// We want to include wasm files as raw data and then we glob for their urls
assetsInclude: ["**/*.wasm"],
resolve: {
dedupe: ["buffer"],
alias: {
path: require.resolve("path-browserify"),
stream: require.resolve("readable-stream/lib/ours/browser.js"),
// This tricks the import into allowing us to use globs with `import.meta.glob`
"@grain/stdlib": path.dirname(require.resolve("@grain/stdlib")),
},
},
define: {
"process.platform": JSON.stringify("posix"),
"process.env.NODE_DEBUG": "false",
},
optimizeDeps: {
esbuildOptions: {
target: "esnext",
define: {
global: "globalThis",
process: JSON.stringify({}),
"process.env": JSON.stringify({}),
"process.platform": JSON.stringify("posix"),
"process.env.NODE_DEBUG": "false",
},
},
},
build: {
target: "es2020",
outDir: "../try",
emptyOutDir: true,
assetsInlineLimit: 0,
},
};
};