Skip to content

feat(v0.2): detect upload.server.config.ts from Nuxt layers #191

@genu

Description

@genu

Context

In src/module.ts, the v0.2 server scaffold resolves the server convention file against nuxt.options.serverDir only:

const conventionFile = join(nuxt.options.serverDir, "upload.server.config.ts")
if (!existsSync(conventionFile)) { /* warn + return */ }

This means a upload.server.config.ts contributed by a Nuxt layer (or when this module is consumed from a layer that wants to provide a default config) is ignored — the warning fires and the handler is never registered, even though the file exists somewhere in the project graph.

Proposal

Iterate nuxt.options._layers and check each layer's serverDir for upload.server.config.ts. First-wins (user project overrides layers) is the usual convention in Nuxt.

Repro

  1. Create a Nuxt layer that exports server/upload.server.config.ts.
  2. Extend it from a host app that does not define its own config.
  3. Expected: server handler registers. Actual: "No server config found" warning, handler skipped.

Notes

Low priority for the initial v0.2 scaffold since most users will put the config directly in their app. Worth resolving before layered usage becomes common.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions