8000 `nuxi prepare` requires two runs to populate `#build/*` in `.nuxt/tsconfig.server.json` · Issue #32220 · nuxt/nuxt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
nuxi prepare requires two runs to populate #build/* in .nuxt/tsconfig.server.json #32220
Open
@chadwickellis

Description

@chadwickellis

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

  1. Initialise a fresh Nuxt 3 project
  2. Run nuxi prepare
  3. Observe that .nuxt/tsconfig.server.json lacks the #build/* path
  4. Run nuxi prepare again
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0