-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
55 lines (52 loc) · 1.47 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
50
51
52
53
54
55
import * as path from "path";
import autoprefixer from "autoprefixer";
import tailwindcss from "tailwindcss";
import { defineConfig } from "vite";
import { VitePWA, VitePWAOptions } from "vite-plugin-pwa";
import solid from "vite-plugin-solid";
import wasm from "vite-plugin-wasm";
import manifest from "./manifest";
const pwaOptions: Partial<VitePWAOptions> = {
base: "/",
registerType: "prompt",
devOptions: {
enabled: false,
},
workbox: {
navigateFallback: "/index.html",
globPatterns: ["**/*.{js,css,html,svg,png,gif,wasm}"],
// mutiny_wasm is 10mb, so we'll do 25mb to be safe
maximumFileSizeToCacheInBytes: 25 * 1024 * 1024,
},
includeAssets: ["favicon.ico", "robots.txt"],
manifest: manifest,
};
export default defineConfig({
build: {
target: "esnext",
outDir: "dist/public",
emptyOutDir: true,
},
server: {
port: 3069,
fs: {
// Allow serving files from one level up (so that if mutiny-node is a sibling folder we can use it locally)
allow: [".."],
},
},
plugins: [wasm(), solid(), VitePWA(pwaOptions)],
resolve: {
alias: [{ find: "~", replacement: path.resolve(__dirname, "./src") }],
},
optimizeDeps: {
// Don't want vite to bundle these late during dev causing reload
include: [],
// This is necessary because otherwise `vite dev` can't find the wasm
exclude: ["@benthecarman/kormir-wasm"],
},
css: {
postcss: {
plugins: [autoprefixer(), tailwindcss()],
},
},
});