-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.mjs
68 lines (66 loc) · 1.67 KB
/
astro.config.mjs
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
62
63
64
65
66
67
68
import { defineConfig } from "astro/config";
import AstroPWA from "@vite-pwa/astro";
import react from "@astrojs/react";
// https://astro.build/config
//
const pwa = AstroPWA({
mode: "development",
base: "/",
scope: "/",
includeAssets: [
"favicon.svg",
"p5-sandbox-icon-192x192.png",
"p5-sandbox-icon-512x512.png",
// "lib/p5.js",
"lib/p5.min.js",
"lib/addons/p5.sound.js",
"lib/addons/p5.sound.min.js",
],
registerType: "autoUpdate",
manifest: {
name: "P5 Code Sandbox",
short_name: "P5Sandbox",
description:
"A code sandbox powered by Monaco editor for testing p5.js code",
start_url: "/",
display: "standalone",
background_color: "#ffffff",
theme_color: "#000000",
icons: [
{
src: "p5-sandbox-icon-192x192.png",
sizes: "192x192",
type: "image/png",
},
{
src: "p5-sandbox-icon-512x512.png",
sizes: "512x512",
type: "image/png",
},
],
categories: ["development", "education", "productivity"],
// related_applications: [],
// prefer_related_applications: false,
},
workbox: {
navigateFallback: "/",
globPatterns: ["**/*.{css,js,html,svg,png,ico,txt}"],
maximumFileSizeToCacheInBytes: 5000000,
},
devOptions: {
enabled: true,
navigateFallbackAllowlist: [/^\//],
},
experimental: {
directoryAndTrailingSlashHandler: true,
},
});
export default defineConfig({
// test if we are in a test env
// currently it seems that in the vite pwa integration
// the plugins for the section astro:config:done are not
// updated well.
// see https://github.com/vite-pwa/astro/blob/d6960671ace5669ea0b760593ef70b34b4d11232/src/index.ts#L72
// need to create a real test for this
integrations: [pwa, react()],
});