code.pablomurad.com

emchess

Browser chess with emoji pieces against Stockfish, no server needed

vite.config.ts raw
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
import { defineConfig } from "vite";
import { VitePWA } from "vite-plugin-pwa";

export default defineConfig({
  base: "./",
  build: {
    target: "es2020",
    assetsInlineLimit: 0,
  },
  plugins: [
    VitePWA({
      registerType: "autoUpdate",
      workbox: {
        globPatterns: ["**/*.{js,css,html,wasm,woff,woff2,svg}"],
        // The Stockfish wasm is ~7MB, so raise the precache size limit.
        maximumFileSizeToCacheInBytes: 9 * 1024 * 1024,
        // Take over at once and drop old caches, so a bad old cache can't linger.
        skipWaiting: true,
        clientsClaim: true,
        cleanupOutdatedCaches: true,
      },
      manifest: {
        name: "Emchess",
        short_name: "Emchess",
        description: "A small chess game with emoji pieces.",
        theme_color: "#f5f1e6",
        background_color: "#f5f1e6",
        display: "standalone",
        icons: [{ src: "icon.svg", sizes: "any", type: "image/svg+xml" }],
      },
    }),
  ],
});