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

Plugin doesn't work on React vite template? #41

Closed
sokryptk opened this issue Apr 4, 2021 · 7 comments
Closed

Plugin doesn't work on React vite template? #41

sokryptk opened this issue Apr 4, 2021 · 7 comments

Comments

@sokryptk
Copy link

sokryptk commented Apr 4, 2021

import { registerSW } from 'virtual:pwa-register'
 
registerSW({
  onOfflineReady() {
    // show a ready to work offline to user
  },
})

Upon build

$ tsc && vite build
node_modules/vite-plugin-pwa/client.d.ts:12:28 - error TS2307: Cannot find module 'vue' or its corresponding type declarations.

import type { Ref } from 'vue'

Do I have to install vue for this plugin to work?

EDIT:

I had to include node_modules/vite-plugin-pwa/client.d.ts in tsconfig.json for VScode to even pick up that such a module exists.

@userquin
Copy link
Member

userquin commented Apr 4, 2021

@krypticallusion can you provide a minimal repro so we can test? thanks

@userquin
Copy link
Member

userquin commented Apr 4, 2021

@krypticallusion, can you can try to add the entry on the tsconfig.json file (if you have exclude node_modules maybe will not work)?

@userquin
Copy link
Member

userquin commented Apr 4, 2021

@krypticallusion can you add types with this?:

"types": [
   "vite-plugin-pwa/client"
]

@userquin
Copy link
Member

userquin commented Apr 4, 2021

imagen

@sokryptk
Copy link
Author

sokryptk commented Apr 4, 2021

https://github.com/krypticallusion/test. This is a fine test repo?

I've tried your above suggestions but they seem to be in vain.

Thanks!

@userquin
Copy link
Member

userquin commented Apr 4, 2021

@krypticallusion add include instead types (similar to exclude in previous picture):

"include": ["vite-plugin-pwa/client"]

I'll try with you repro...

@antfu antfu closed this as completed in 02e2fba Apr 4, 2021
@sokryptk
Copy link
Author

sokryptk commented Apr 4, 2021

0.6.5 seems to resolve the issue. Thanks!

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

No branches or pull requests

2 participants