Cannot find module 'virtual:pwa-register' in vscode

See original GitHub issue

Hi, vscode is showing error ts2307 on the line import { registerSW } from 'virtual:pwa-register' which is near the top of my app.ts file. Everything compiles and works, but vscode is complaining. I’m wondering whether it’s a problem or something I missed?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

11reactions
userquincommented, Apr 4, 2021

@qgates

try adding entry on types on tsconfig.json file: "vite-pluginb-pwa/client"

imagen

1reaction
qgatescommented, Apr 4, 2021

@qgates

try adding entry on types on tsconfig.json file: "vite-pluginb-pwa/client"

@userquin that works, thanks

0.6.5 doesn’t change anything specific to this issue, although it does stop vscode complaining about Ref if I open vite-plugin-pwa/client.d.ts (since I’m using vue2 in this project).

So it appears the types approach works in addition to options 3, 4 in my post above. Your approach is the cleanest so that’s probably the way to go. Many thanks.

I created PR #42 to help others avoid this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'virtual:pwa-register' in vscode #40 - GitHub
Hi, vscode is showing error ts2307 on the line import { registerSW } from 'virtual:pwa-register' which is near the top of my app.ts...
Read more >
User and Workspace Settings - Visual Studio Code
When you open the Settings editor, you can search and discover the settings ... The error can be as simple as a missing...
Read more >
Cannot find module '@vitejs/plugin-react' or its corresponding ...
Issue. I have created the project using npm create vite@latest and I choose ts-react, when I ran the script the. npm run dev...
Read more >
PWA & Vite: Development of a Progressive Web App with Vue 3
PWA registration ​​ This component (ReloadPWA. vue) will show a button to update the application content if the Service Worker finds changes.
Read more >
Could not find a declaration file for module ''react-materialize ...
You need to install the typings/types for the package (npm install @types/react-materialize). However, it looks like this doesn't exist yet, so ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found