Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PWA: Pre-cache application assets #321

Open
meganindya opened this issue Feb 26, 2023 · 3 comments
Open

PWA: Pre-cache application assets #321

meganindya opened this issue Feb 26, 2023 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers ui-framework Issues related to the core UI framework

Comments

@meganindya
Copy link
Member

The following asset files are generated during the build but aren't picked up by the PWA plugin due to certain rules mentioned in https://vite-pwa-org.netlify.app/guide/static-assets.html.

We need to find a way to insert these into the precacheAndRoute list in sw.js so they can be cached for PWA/offline.

build-53e87ed8.svg
close-444dc9a6.svg
code-74870b2e.svg
exportDrawing-aee43b5d.svg
help-a0383ce2.svg
logo-3080f493.png
mouse-46cf41ce.svg
pin-8515e01d.svg
reset-a8de2102.svg
run-123f2282.svg
saveProjectHTML-e442bff6.svg
startRecording-5dec9e0d.svg
stop-aa193098.svg
stopRecording-48f9a011.svg
unpin-427cfcc6.svg
@meganindya meganindya added bug Something isn't working good first issue Good for newcomers ui-framework Issues related to the core UI framework labels Feb 26, 2023
@ABHINAV-JHA-27
Copy link
Member

Hey @meganindya, I am unable to locate sw.js file in the codebase.
can you tell me where to look ?

@Karan-Palan
Copy link

We can first customise the Vite PWA config like this

// vite.config.js

import VitePWA from 'vite-plugin-pwa';

export default {
  plugins: [
    VitePWA({
      includeAssets: [
        'build-53e87ed8.svg',
        'close-444dc9a6.svg',
        'code-74870b2e.svg',
        'exportDrawing-aee43b5d.svg',
        'help-a0383ce2.svg',
        'logo-3080f493.png',
        'mouse-46cf41ce.svg',
        'pin-8515e01d.svg',
        'reset-a8de2102.svg',
        'run-123f2282.svg',
        'saveProjectHTML-e442bff6.svg',
        'startRecording-5dec9e0d.svg',
        'stop-aa193098.svg',
        'stopRecording-48f9a011.svg',
        'unpin-427cfcc6.svg',
      ],
    }),
  ],
};

We can the adjust the service worker.

Does this approach seem appropriate @walterbender @meganindya

@dipaksinha1
Copy link

dipaksinha1 commented Dec 29, 2023

Hi ,I encountered an issue where certain asset files generated during the build are not picked up by the PWA plugin. The provided precaching logic in the Vite configuration doesn't seem to include these assets.

Could you please review and provide feedback on Pull Request #380?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers ui-framework Issues related to the core UI framework
Projects
None yet
Development

No branches or pull requests

4 participants