-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
61 lines (60 loc) · 1.77 KB
/
vite.config.js
File metadata and controls
61 lines (60 loc) · 1.77 KB
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
56
57
58
59
60
61
import { defineConfig } from "vite";
import { VitePWA } from "vite-plugin-pwa";
export default defineConfig({
base: "./", // Ensures assets are loaded correctly on GitHub Pages
build: {
target: "esnext", // WebAssembly requires modern browser support
rollupOptions: {
input: {
main: 'index.html',
docs: 'docs.html',
about: 'about.html',
contact: 'contact.html'
}
}
},
plugins: [
VitePWA({
registerType: "autoUpdate",
injectRegister: "auto",
manifest: {
name: "Ruby Sandbox",
short_name: "Ruby Sandbox",
description: "An interactive Ruby playground and sandbox environment. Run Ruby code directly in your browser using WebAssembly.",
theme_color: "#cc342d",
background_color: "#1e1e1e",
display: "standalone",
start_url: "./index.html",
icons: [
{
src: "favicon.svg",
sizes: "any",
type: "image/svg+xml",
purpose: "any maskable"
}
]
},
workbox: {
maximumFileSizeToCacheInBytes: 50000000,
// Removed 'wasm' from precache so it doesn't download on page load
globPatterns: ["**/*.{js,css,html,ico,png,svg}"],
cleanupOutdatedCaches: true,
// Add runtime caching for WASM files
runtimeCaching: [{
urlPattern: ({ url }) => url.pathname.endsWith('.wasm'),
handler: 'CacheFirst',
options: {
cacheName: 'ruby-wasm-cache',
expiration: {
maxEntries: 2,
maxAgeSeconds: 60 * 60 * 24 * 30, // 30 Days
},
cacheableResponse: {
statuses: [0, 200]
}
}
}]
},
}),
],
});