shaunchander / astro-pwa-starter

✨ An opinionated Astro starter for building robust static websites.
astro-pwa-starter.vercel.app
205 stars 44 forks source link

Missing some files #7

Closed MC-dusk closed 1 year ago

MC-dusk commented 1 year ago

can't find registerSW.js and manifest.webmanifest

but they are in Layout.astro

https://github.com/shaunchander/astro-pwa-starter/blob/3ec78ebcf1ebb0c99b363b236d6dbd7903d48e4c/src/components/global/Layout/Layout.astro#L161-L162

Jsox commented 1 year ago

These files will be generated on production. Just run astro build and look at dist folder

MC-dusk commented 1 year ago

ok, I just ran pnpm run dev, and the console showed:

12:56:13 [serve]    404                           /registerSW.js
12:56:35 [serve]    404                    /favicons/favicon.svg
12:56:35 [serve]    404                    /manifest.webmanifest

when I used pnpm run build and pnpm run preview, that worked fine.

MC-dusk commented 1 year ago

But there are other problems:

  1. the pic in profile is down https://github.com/shaunchander/astro-pwa-starter/blob/3ec78ebcf1ebb0c99b363b236d6dbd7903d48e4c/src/pages/index.astro#L52
  2. missing favicon.svg in assets or favicons folder
shaunchander commented 1 year ago

Hey @MC-dusk, thanks for opening an issue!

When you run pnpm run build, the registerSW.js and manifest.webmanifest files are generated for your at build time.

Make sure that the empty script tag is present inside of Layout.astro. This is a hack we use to make vite-plugin-pwa generate those files.

shaunchander commented 1 year ago

Marking as closed.