Closed vinoddotcom closed 2 weeks ago
Did you have @vite-pwa/assets-generator
installed?
No, i did't install @vite-pwa/assets-generator
upps, forgot it, I'm going to release a new patch version in a few minutes, I need to remove unused import (try adding vite-plugin-pwa
dependency in your reproduction):
Please take a look at the screenshot related to the project I’m currently working on. There were multiple import errors initially flagged as 'not found.' However, after disabling the noUnusedLocals
rule in the TypeScript configuration, these errors were resolved.
No idea why checking types from node_modules
, here your reproduction (moved noUnusedLocals
to nuxt config file, added vite-plugin-pwa
and using nuxt pwa from this PR https://github.com/vite-pwa/nuxt/pull/161) working: https://stackblitz.com/edit/github-zjpmae-mvu5fh?file=nuxt.config.ts
@userquin Here is a minimum reproduction of my case where multiple import errors were initially flagged as 'not found.
Minimum Reproduction: https://stackblitz.com/edit/github-yp7irr?file=package.json
I used to register the service worker through the plugins folder. Check: plugins -> init.client.ts
Steps:
npm run clean-install
npm run clean-test
@userquin Node_module is excluded in tsconfig.json, but somehow it still checks all .vue
files including node_modules.
@userquin After running
npm run clean-install
npm run clean-test
I found these lines in ./nuxt/tsconfig.json
, which is why TypeScript checks those files inside the node module.
"../node_modules/@vite-pwa/nuxt/runtime",
"../node_modules/@vite-pwa/nuxt/dist/runtime",
In node_modules/@vite-pwa/nuxt/dist/runtime
, file types are imported with #build/
. This is configured in ./nuxt/tsconfig.json
. as
"#build/": [
"./"
],
In general, the default character we use is either ~/
or @/
, which is configured in ./nuxt/tsconfig.json
as such.
"~/*": [
"../*"
],
"@/*": [
"../*"
],
Could you please check if it should be #build/
or @/
?
It should be #build/
since the types are generated inside the .nuxt
folder, check pwa-icons
subfolder.
@userquin Here is a minimum reproduction of my case where multiple import errors were initially flagged as 'not found.
Minimum Reproduction: https://stackblitz.com/edit/github-yp7irr?file=package.json
I used to register the service worker through the plugins folder. Check: plugins -> init.client.ts
Steps:
npm run clean-install
npm run clean-test
- See error
@userquin Can you please investigate why this issue is occurring based on its reproduction (https://stackblitz.com/edit/github-yp7irr?file=package.json)?
It is fine on my local, using node 20.10.0.
can you update vue to 3.5.3
? I'm getting some error using Nuxt 3.13.1
and internal useId
:
"devDependencies": {
"@vite-pwa/nuxt": "0.10.5",
"nuxt": "3.13.1",
"typescript": "5.5.4",
"vue": "^3.5.3",
"vue-tsc": "2.1.6"
},
"resolutions": {
"vue": "3.5.3"
}
I also change the clean-test
script in your SB reproduction to "clean-test": "rm -rf .output && npx nuxi prepare && npx nuxi typecheck"
: https://stackblitz.com/edit/github-yp7irr-36g6ny?file=package.json
Running works:
npm run clean-install
npm run clean-test
@userquin, thank you for your response. Everything is running fine now.
In Nuxt.js project that uses TypeScript, enabling the noUnusedLocals option in tsconfig.json causes the build to fail.
Screenshot:
Minimum Reproduction: https://stackblitz.com/edit/github-zjpmae?file=package.json
Steps:
npm i
npm run test