forked from inkandswitch/tiny-essay-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
49 lines (46 loc) · 1.41 KB
/
vite.config.ts
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
48
49
// vite.config.ts
import { defineConfig } from "vite";
import path from "path";
import react from "@vitejs/plugin-react";
import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await";
export default defineConfig({
base: "./",
plugins: [topLevelAwait(), wasm(), react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
worker: {
format: "es",
plugins: [wasm()],
},
optimizeDeps: {
// This is necessary because otherwise `vite dev` includes two separate
// versions of the JS wrapper. This causes problems because the JS
// wrapper has a module level variable to track JS side heap
// allocations, and initializing this twice causes horrible breakage
exclude: [
"@automerge/automerge-wasm",
"@automerge/automerge-wasm/bundler/bindgen_bg.wasm",
"@syntect/wasm",
],
},
build: {
rollupOptions: {
output: {
// We put index.css in dist instead of dist/assets so that we can link to fonts
// using relative URLs like "./assets/font.woff2", which is the correct form
// for deployment to trailrunner.
assetFileNames: (assetInfo) => {
if (assetInfo.name === "index.css") {
return "[name][extname]";
}
// For all other assets, keep the default behavior
return "assets/[name]-[hash][extname]";
},
},
},
},
});