vite-plugin-pwa
vite-plugin-pwa copied to clipboard
sw.js not generated with Astro build
When doing astro build
command sw.js is not being generated.
Astro version: 1.0.0-beta.64 vite-plugin-pwa version: 0.11.11 vite version: 2.9.13
My astro.config.mjs
import { defineConfig } from 'astro/config';
import { VitePWA } from 'vite-plugin-pwa';
import tailwind from '@astrojs/tailwind';
export default defineConfig({
integrations: [tailwind()],
vite: {
plugins: [
VitePWA({
includeAssets: [
'favicon.png',
'robots.txt',
'manifest.webmanifest',
'assets/icons/*.png',
'assets/icons/*.svg',
'assets/fonts/Splash-Regular.ttf',
],
registerType: 'autoUpdate',
manifest: {
short_name: 'AngelNext',
name: 'AngelNext',
start_url: '/',
icons: [
{
src: 'favicon.png',
type: 'image/png',
sizes: '500x500',
},
],
background_color: '#111827',
display: 'standalone',
scope: '/',
theme_color: '#111827',
description: 'Portfolio website for AngelNext',
},
}),
],
},
});
@AngelNext we're working on the Astro integration, the PR is ready to review on the Astro repo: https://github.com/withastro/astro/pull/3428
EDIT: I need to resolve conflicts on the PR, but I cannot resolve them every day, when Astro ppl want to include it, I'll fix the conflicts.
Hey, for some reason sw.js
will not be generated in Astro unless you are hoisting a client-side script inside your Layout.astro
file or wherever the entry-point of your Astro site is. Simply add an empty script tag and sw.js
will then be included in your dist
bundle. This works for [email protected]
Released initial version of astro integration: https://vite-pwa-org.netlify.app/frameworks/astro.html