How can i ignore some folders in my app when run pnpm nuxi typecheck
I have i typescript params in my nuxt config
And i have a tsconfig.json in the root folder with that in
All my code is in the "app" folder. Exemple: app/app-modules/explore/...
That the results of my pnpm nuxi typecheck:
3 Replies
Hi @Ducky. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To ignore specific folders or files during type checking with
Make sure that
While the
If possible, move folders you want to exclude outside of the main app directory, so they're not picked up by Nuxt or vue-tsc at all. 4. Custom Typecheck Script:
If Nuxt's built-in type checking doesn't respect your
The knowledge sources do not explicitly confirm that the
pnpm nuxi typecheck
, you might expect that adding them to the exclude
array in your root tsconfig.json
would be sufficient. However, in Nuxt, the .nuxt/tsconfig.json
file is auto-generated and your root tsconfig.json
extends it. Any options you set in your root tsconfig.json
(like exclude
) will override the generated config, but there are some caveats:
- The Nuxt documentation and issues indicate that customizing exclude
in your root tsconfig.json
should work, but if you overwrite certain options (like compilerOptions.paths
), you may lose important Nuxt-specific module resolutions, which can break type support for things like #imports
and aliases. This doesn't directly affect exclude
, but it's a sign that not all customizations are always respected as expected by the Nuxt tooling [Nuxt TypeScript Concepts].
- The nuxt typecheck
command uses vue-tsc
and the generated .nuxt/tsconfig.json
as its base. If your exclude
is not being respected, it may be because the type checker is not using your root tsconfig.json
as the entry point, but rather the generated one [nuxt typecheck command].
What you can try:
1. Check the Effective tsconfig Used by vue-tsc:Make sure that
vue-tsc
is actually using your root tsconfig.json
(with your exclude
), not just .nuxt/tsconfig.json
. If not, your exclude
settings may be ignored.
2. Use the ignore
Option in nuxt.config:While the
ignore
option in nuxt.config
is primarily for build-time file ignoring, not type checking, it may help reduce what files Nuxt processes overall [ignore option].
3. Move Excluded Folders Outside the App Directory:If possible, move folders you want to exclude outside of the main app directory, so they're not picked up by Nuxt or vue-tsc at all. 4. Custom Typecheck Script:
If Nuxt's built-in type checking doesn't respect your
exclude
, you can run vue-tsc
directly with your desired config:
This gives you full control over the tsconfig.json
used.
Summary:The knowledge sources do not explicitly confirm that the
exclude
field in your root tsconfig.json
will always be respected by pnpm nuxi typecheck
, since Nuxt generates and uses its own .nuxt/tsconfig.json
for type checking. If your exclusions are not working, consider running vue-tsc
directly with your config, or restructure your project so unwanted files are not included in the type check scope [Nuxt TypeScript Concepts].
If you need more granular control, you may need to wait for further improvements in Nuxt's type checking integration, as some related issues have been discussed in the community [Github Issue: failed to resolve "extends":"./.nuxt/tsconfig.json"].
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@272718635137499146> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Still not working with you adivce..
Still not working with you adivce.. I try every steps but is still check the folder explore