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

feat: load workbox window with dynamic import #367

Merged
merged 3 commits into from Sep 17, 2022

Conversation

userquin
Copy link
Member

@userquin userquin commented Sep 2, 2022

closes #354

@netlify
Copy link

netlify bot commented Sep 2, 2022

Deploy Preview for vite-plugin-pwa ready!

Name Link
🔨 Latest commit eb487b9
🔍 Latest deploy log https://app.netlify.com/sites/vite-plugin-pwa/deploys/63262b660f563a0009760a21
😎 Deploy Preview https://deploy-preview-367--vite-plugin-pwa.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@userquin userquin requested a review from antfu September 2, 2022 23:00
@userquin userquin merged commit 6b17dfe into main Sep 17, 2022
@userquin userquin deleted the userquin/feat-dynamic-workbox-window branch September 17, 2022 20:19
@strarsis
Copy link

strarsis commented Jun 8, 2023

@userquin: This may be a bit on a tangent – but how can I use workbox-window, notably the messageSW method from inside the page/window? I import and invoke registerSW from virtual:pwa-register. But workbox is initialized in the generated code and not attached anyway (e.g. window), so I can use it.

Edit: Currently I have solved this by importing registerSW from workbox-window, and that variant expects two arguments, the former being a reference to the ServiceWorker - which I can actually retrieve.

@userquin
Copy link
Member Author

userquin commented Jun 8, 2023

@strarsis check this https://developer.chrome.com/docs/workbox/modules/workbox-window/#advanced-bundling-concepts

You can use static/dynamic import, isn't working for you?: import { messageSW } from 'workbox-window'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Load workbox-window with dynamic import
3 participants