Fix sw.js not registering and lint

This commit is contained in:
Luis Canada
2025-10-10 21:24:06 -04:00
parent 2171074217
commit 8e37e70913
+33 -30
View File
@@ -11,15 +11,17 @@ export default defineConfig({
outDir: path.resolve(__dirname, './out/web'), outDir: path.resolve(__dirname, './out/web'),
rollupOptions: { rollupOptions: {
input: { input: {
"32x32": normalizePath(path.resolve(__dirname, './assets/icons/32x32.png')), '32x32': normalizePath(path.resolve(__dirname, './assets/icons/32x32.png')),
"64x64": normalizePath(path.resolve(__dirname, './assets/icons/64x64.png')), '64x64': normalizePath(path.resolve(__dirname, './assets/icons/64x64.png')),
"128x128": normalizePath(path.resolve(__dirname, './assets/icons/128x128.png')), '128x128': normalizePath(path.resolve(__dirname, './assets/icons/128x128.png')),
"256x256": normalizePath(path.resolve(__dirname, './assets/icons/256x256.png')), '256x256': normalizePath(path.resolve(__dirname, './assets/icons/256x256.png')),
"512x512": normalizePath(path.resolve(__dirname, './assets/icons/512x512.png')), '512x512': normalizePath(path.resolve(__dirname, './assets/icons/512x512.png')),
"1024x1024": normalizePath(path.resolve(__dirname, './assets/icons/1024x1024.png')), '1024x1024': normalizePath(path.resolve(__dirname, './assets/icons/1024x1024.png')),
"preview_full_screen_player": normalizePath(path.resolve(__dirname, './media/preview_full_screen_player.png')),
favicon: normalizePath(path.resolve(__dirname, './assets/icons/favicon.ico')), favicon: normalizePath(path.resolve(__dirname, './assets/icons/favicon.ico')),
index: normalizePath(path.resolve(__dirname, './src/renderer/index.html')), index: normalizePath(path.resolve(__dirname, './src/renderer/index.html')),
preview_full_screen_player: normalizePath(
path.resolve(__dirname, './media/preview_full_screen_player.png'),
),
}, },
output: { output: {
assetFileNames: 'assets/[name].[ext]', assetFileNames: 'assets/[name].[ext]',
@@ -48,68 +50,69 @@ export default defineConfig({
web: true, web: true,
}), }),
VitePWA({ VitePWA({
registerType: 'autoUpdate',
scope: "/",
devOptions: { devOptions: {
// The PWA will not be shown during development // The PWA will not be shown during development
enabled: false, enabled: false,
}, },
workbox: { filename: 'assets/sw.js',
maximumFileSizeToCacheInBytes: 1000000 * 5 // 5 MB injectRegister: 'inline',
},
outDir: path.resolve(__dirname, "./out/web/assets"),
injectRegister: "inline",
manifestFilename: "assets/manifest.webmanifest",
manifest: { manifest: {
name: 'Feishin',
short_name: 'Feishin',
start_url: '/',
background_color: '#FFDCB5', background_color: '#FFDCB5',
theme_color: '#1E003D', display: 'standalone',
icons: [ icons: [
{ {
src: '32x32.png',
sizes: '32x32', sizes: '32x32',
src: '32x32.png',
type: 'image/png', type: 'image/png',
}, },
{ {
src: '64x64.png',
sizes: '64x64', sizes: '64x64',
src: '64x64.png',
type: 'image/png', type: 'image/png',
}, },
{ {
src: '128x128.png',
sizes: '128x128', sizes: '128x128',
src: '128x128.png',
type: 'image/png', type: 'image/png',
}, },
{ {
src: '256x256.png',
sizes: '256x256', sizes: '256x256',
src: '256x256.png',
type: 'image/png', type: 'image/png',
}, },
{ {
src: '512x512.png', purpose: 'any',
sizes: '512x512', sizes: '512x512',
src: '512x512.png',
type: 'image/png', type: 'image/png',
purpose: "any"
}, },
{ {
src: '1024x1024.png',
sizes: '1024x1024', sizes: '1024x1024',
src: '1024x1024.png',
type: 'image/png', type: 'image/png',
}, },
], ],
display: 'standalone', name: 'Feishin',
orientation: 'portrait', orientation: 'portrait',
screenshots: [ screenshots: [
{ {
src: 'preview_full_screen_player.png',
sizes: '1440x900',
type: 'image/png',
form_factor: 'wide', form_factor: 'wide',
label: 'Full screen player showing music player and lyrics', label: 'Full screen player showing music player and lyrics',
sizes: '1440x900',
src: 'preview_full_screen_player.png',
type: 'image/png',
}, },
], ],
short_name: 'Feishin',
start_url: '/',
theme_color: '#1E003D',
},
manifestFilename: 'assets/manifest.webmanifest',
outDir: path.resolve(__dirname, './out/web/'),
registerType: 'autoUpdate',
scope: '/assets/',
workbox: {
maximumFileSizeToCacheInBytes: 1000000 * 5, // 5 MB
}, },
}), }),
], ],