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

fix: skip waiting check #306

Merged
merged 2 commits into from
Jun 30, 2022
Merged

fix: skip waiting check #306

merged 2 commits into from
Jun 30, 2022

Conversation

mastercoms
Copy link
Contributor

No description provided.

@netlify
Copy link

netlify bot commented Jun 11, 2022

Deploy Preview for vite-plugin-pwa ready!

Name Link
🔨 Latest commit 59e5e6c
🔍 Latest deploy log https://app.netlify.com/sites/vite-plugin-pwa/deploys/62ad9fe543924f000839ee93
😎 Deploy Preview https://deploy-preview-306--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 self-assigned this Jun 16, 2022
@userquin
Copy link
Member

userquin commented Jun 16, 2022

@mastercoms thanks a lot, looks like you've found the ghost of injectRegister, I need to do some internal tests with îles

@userquin userquin mentioned this pull request Jun 18, 2022
@userquin
Copy link
Member

userquin commented Jun 18, 2022

@mastercoms can you change also this code (replace the transformIndexHtml) on src/index.ts module?

EDIT: I've included it

      transformIndexHtml: {
        enforce: 'post',
        transform(html) {
          if (options.disable)
            return html

          // if virtual register is requested, do not inject.
          if (options.injectRegister === 'auto')
            options.injectRegister = useImportRegister ? null : 'script'

          return injectServiceWorker(html, options)
        },
      },

If the virtual module is not being called, then the `registerSW.js`  is generated, but the `transform` hook on `tranformIndexHtml` is being called before `generateBundle` and so we also need to check it on that hook
@userquin userquin requested a review from antfu June 18, 2022 09:55
@userquin
Copy link
Member

userquin commented Jun 18, 2022

to test it use the cdn example, just remove the base and add the registerType: 'autoUpdate' on the vite config file and remove the ReloadPrompt from the App (run pnpm run build from root folder and them pnpm run run-build && pnpm run serve from examples/vue-basic-cdn folder)

you can also run some example, from root folder run pnpm run examples

@antfu antfu changed the title fix skip waiting check fix: skip waiting check Jun 30, 2022
@antfu antfu merged commit d27a9a1 into vite-pwa:main Jun 30, 2022
@mastercoms mastercoms deleted the patch-1 branch June 30, 2022 14:35
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.

None yet

3 participants