tiny fixes
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
"@types/audioworklet": "^0.0.49",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^4.4.5",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-pwa": "^0.16.7"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
11
src/main.ts
11
src/main.ts
@ -480,3 +480,14 @@ export class Editor {
|
||||
|
||||
let app = new Editor();
|
||||
installWindowBehaviors(app, window, false);
|
||||
if ("serviceWorker" in navigator) {
|
||||
window.addEventListener("load", function() {
|
||||
navigator.serviceWorker
|
||||
.register("./generate-sw.js")
|
||||
// @ts-ignore
|
||||
.then(res => console.log("Service worker registered"))
|
||||
.catch(err => console.log("Service worker not registered: ", err))
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
// import * as mdPlugin from 'vite-plugin-markdown';
|
||||
import { VitePWA } from "vite-plugin-pwa";
|
||||
import viteCompression from "vite-plugin-compression";
|
||||
|
||||
const webManifest = {
|
||||
name: "Topos",
|
||||
@ -9,31 +9,34 @@ const webManifest = {
|
||||
theme_color: "#ffffff",
|
||||
icons: [
|
||||
{
|
||||
src: 'favicon/android-chrome-192x192.png',
|
||||
sizes: '192x192',
|
||||
type: 'image/png'
|
||||
src: "favicon/android-chrome-192x192.png",
|
||||
sizes: "192x192",
|
||||
type: "image/png",
|
||||
purpose: "any maskable",
|
||||
},
|
||||
{
|
||||
src: 'favicon/android-chrome-512x512.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png'
|
||||
src: "favicon/android-chrome-512x512.png",
|
||||
sizes: "512x512",
|
||||
type: "image/png",
|
||||
purpose: "any maskable",
|
||||
},
|
||||
]
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
export default defineConfig(({ command, mode, ssrBuild }) => {
|
||||
if (command === "serve") {
|
||||
return {
|
||||
plugins: [
|
||||
viteCompression(),
|
||||
VitePWA({
|
||||
includeAssets: [
|
||||
'favicon/favicon.icon',
|
||||
'favicon/apple-touch-icon.png',
|
||||
'mask-icon.svg'
|
||||
"favicon/favicon.icon",
|
||||
"favicon/apple-touch-icon.png",
|
||||
"mask-icon.svg",
|
||||
],
|
||||
manifest: webManifest,
|
||||
registerType: 'autoUpdate'
|
||||
})
|
||||
registerType: "autoUpdate",
|
||||
}),
|
||||
],
|
||||
assetsInclude: ["**/*.md"],
|
||||
server: {
|
||||
@ -44,15 +47,16 @@ export default defineConfig(({ command, mode, ssrBuild }) => {
|
||||
} else {
|
||||
return {
|
||||
plugins: [
|
||||
viteCompression(),
|
||||
VitePWA({
|
||||
includeAssets: [
|
||||
'favicon/favicon.icon',
|
||||
'favicon/apple-touch-icon.png',
|
||||
'mask-icon.svg'
|
||||
"favicon/favicon.icon",
|
||||
"favicon/apple-touch-icon.png",
|
||||
"mask-icon.svg",
|
||||
],
|
||||
manifest: webManifest,
|
||||
registerType: 'autoUpdate'
|
||||
})
|
||||
registerType: "autoUpdate",
|
||||
}),
|
||||
],
|
||||
chunkSizeWarningLimit: 1600 * 2,
|
||||
build: {
|
||||
|
||||
22
yarn.lock
22
yarn.lock
@ -1764,7 +1764,7 @@ chalk@^2.4.2:
|
||||
escape-string-regexp "^1.0.5"
|
||||
supports-color "^5.3.0"
|
||||
|
||||
chalk@^4.0.2:
|
||||
chalk@^4.0.2, chalk@^4.1.2:
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
|
||||
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
|
||||
@ -1885,7 +1885,7 @@ cssesc@^3.0.0:
|
||||
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee"
|
||||
integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==
|
||||
|
||||
debug@^4.1.0, debug@^4.1.1, debug@^4.3.4:
|
||||
debug@^4.1.0, debug@^4.1.1, debug@^4.3.3, debug@^4.3.4:
|
||||
version "4.3.4"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
|
||||
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
|
||||
@ -2180,6 +2180,15 @@ front-matter@^4.0.0:
|
||||
dependencies:
|
||||
js-yaml "^3.13.1"
|
||||
|
||||
fs-extra@^10.0.0:
|
||||
version "10.1.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
|
||||
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
|
||||
dependencies:
|
||||
graceful-fs "^4.2.0"
|
||||
jsonfile "^6.0.1"
|
||||
universalify "^2.0.0"
|
||||
|
||||
fs-extra@^9.0.1:
|
||||
version "9.1.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
|
||||
@ -3601,6 +3610,15 @@ util-deprecate@^1.0.2:
|
||||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
||||
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
|
||||
|
||||
vite-plugin-compression@^0.5.1:
|
||||
version "0.5.1"
|
||||
resolved "https://registry.yarnpkg.com/vite-plugin-compression/-/vite-plugin-compression-0.5.1.tgz#a75b0d8f48357ebb377b65016da9f20885ef39b6"
|
||||
integrity sha512-5QJKBDc+gNYVqL/skgFAP81Yuzo9R+EAf19d+EtsMF/i8kFUpNi3J/H01QD3Oo8zBQn+NzoCIFkpPLynoOzaJg==
|
||||
dependencies:
|
||||
chalk "^4.1.2"
|
||||
debug "^4.3.3"
|
||||
fs-extra "^10.0.0"
|
||||
|
||||
vite-plugin-markdown@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/vite-plugin-markdown/-/vite-plugin-markdown-2.1.0.tgz#3c90b91eb8c05a5701d944e9948739f514c79af1"
|
||||
|
||||
Reference in New Issue
Block a user