Description
Environment
- Operating System:
Darwin
- Node Version:
v20.19.1
- Nuxt Version:
3.17.4
- CLI Version:
3.25.1
- Nitro Version:
2.11.12
- Package Manager:
npm@10.8.2
- Builder:
-
- User Config:
-
- Runtime Modules:
-
- Build Modules:
-
Reproduction
- Initialise a fresh Nuxt 3 project
- Run
nuxi prepare
- Observe that
.nuxt/tsconfig.server.json
lacks the#build/*
path - Run
nuxi prepare
again - Observe that
#build/*
is now present in.nuxt/tsconfig.server.json
Describe the bug
Running nuxi prepare
once on a fresh project does not add the #build/*
path to .nuxt/tsconfig.server.json
. The path only appears after running the command a second time.
This is because the .nuxt
directory does not yet exist when .nuxt/tsconfig.server.json
is first generated, so the logic at packages/nuxt/src/core/nitro.ts#L477-L482
cannot resolve the relative build path on first run.
Additional context
I'm authoring a Nuxt module that writes type definitions to the consuming application's build directory. These must be accessible from the server
directory during type checking. While running nuxi prepare
twice is tolerable in application development, it creates friction in module development, where repeated execution of nuxt-module-build prepare
and nuxi prepare playground
is required to satisfy TypeScript.