Getting typescript error "module '@nuxt/schema' cannot be found" when extending layer template
Environment
app:
- Operating System: `Darwin`
- Node Version: `v18.16.0`
- Nuxt Version: `3.6.5`
- Nitro Version: `2.5.2`
- Package Manager: `[email protected]`
- Builder: `vite`
- User Config: `extends`, `typescript`, `devtools`
- Runtime Modules: `-`
- Build Modules: `-`
nuxt-layer:
- Operating System: `Darwin`
- Node Version: `v18.16.0`
- Nuxt Version: `3.6.5`
- Nitro Version: `2.5.2`
- Package Manager: `[email protected]`
- Builder: `vite`
- User Config: `typescript`
- Runtime Modules: `-`
- Build Modules: `-`
Reproduction
- clone repo https://github.com/DawidKopys/nuxt-schema-error-repro
- run
npm iin nuxt-layer directory - run
npm iin app directory - run
npx nuxi typecheck/npm run dev/npx vue-tsc --noEmitinsideappdirectory. You should get below error:
../nuxt-layer/app.config.ts:7:16 - error TS2664: Invalid module name in augmentation, module '@nuxt/schema' cannot be found.
7 declare module '@nuxt/schema' {
~~~~~~~~~~~~~~
Found 1 error in ../nuxt-layer/app.config.ts:7
Describe the bug
- the app directory was created by running
npx nuxi@latest init appfrom the docs - the nuxt-layer directory was created with nuxt layer template - by running
npx nuxi init --template layer nuxt-layercommand from the docs - type checking was enabled in both directories by simply running
npm install --save-dev typescript vue-tscand turning type checking insidenuxt.config.tsfor both directories
So, basically, I have just used the starters for app and layer, turned type checking for them, and I am getting this ts error straight away.
This error is very confusing to me as using @nuxt/schema was a solution to my previous (similar) issue and it works just fine if I use it in the repo linked in the issue - https://github.com/DawidKopys/nuxt-layers. But for some reason it doesn't work in above simple setup.
Additional context
Using @nuxt/schema was a solution to my previous (similar) issue and it works just fine if I use it in the repo linked in the issue - https://github.com/DawidKopys/nuxt-layers. But for some reason it doesn't work in above simple setup.
Logs
No response
might help:
- https://github.com/nuxt/cli/pull/264
at least I hope so :pray:
Somehow adding import "nuxt/schema" on top worked for me
Somehow adding
import "nuxt/schema"on top worked for me
The result of same import for me is broken DevTools and vite:
This should be resolved in the latest version of Nuxt with https://github.com/nuxt/nuxt/pull/26158. Let me know if not and I'll happily reopen 🙏