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

Cannot find module '#pwa' or its corresponding type declarations. #123

Open
brugomes opened this issue Mar 25, 2024 · 4 comments
Open

Cannot find module '#pwa' or its corresponding type declarations. #123

brugomes opened this issue Mar 25, 2024 · 4 comments

Comments

@brugomes
Copy link

I'm following the basic instructions to setup @vite-pwa/nuxt

pnpm add @vite-pwa/nuxt -D

// nuxt.config.ts
import { defineNuxtConfig } from 'nuxt/config'

export default defineNuxtConfig({
  modules: [
    '@vite-pwa/nuxt'
  ],
  pwa: {
    /* PWA options */
  }
})

And got this error.

image
image

I also have tryed this and got the same error.

rm -Rf node_modules
rm -Rf dist
rm -Rf .nuxt
pnpm store prune
pnpm add @vite-pwa/nuxt -D --force  
@snolan-ethika
Copy link

@brugomes did you happen to fix this? Also seeing this error...

@userquin
Copy link
Member

userquin commented Jun 6, 2024

Error when adding the pwa module? Provide a minimal reproduction, all my tests can install the pwa module: check https://vite-pwa-org.netlify.app/guide/scaffolding.html , follow the prompts selecting Vue when asking for Framework then Nuxt.

Maybe you can try adding .npmrc file with shamefully-hoist=true (iirc only pnpm).

@snolan-ethika @brugomes

@YunYouJun
Copy link

My guess is that you used nuxt as monorepo and used your own tsconfig.json compilterOptions.paths, which overrides nuxt's default generated tsconfig paths setting (#pwa).

@pawelgur
Copy link

pawelgur commented Nov 19, 2024

Bumped into similar issue:

 ERROR
 ERROR(vue-tsc)  Cannot find module '#build/pwa-icons/pwa-icons' or its corresponding type declarations.
 FILE  ......./.nuxt/pwa-icons-plugin.ts:3:31

    1 | // Generated by @vite-pwa/nuxt
    2 | import { defineNuxtPlugin } from '#imports'
  > 3 | import type { PWAIcons } from '#build/pwa-icons/pwa-icons'
      |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    4 |
    5 | export default defineNuxtPlugin(() => {
    6 |   return {

After some @nuxt/kit version update (3.14.x? brought by some other dep) #build alias was not inserted in tsconfig.json in .nuxt anymore.

Downgrading @nuxt/kit down to 3.11.2 (matching current nuxt version) solved the issue for me.

@vite-pwa/[email protected]

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

No branches or pull requests

5 participants