Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
feat(schema, nuxt): allow user-configurable serverDir
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Sep 27, 2022
1 parent 2e080c2 commit 53851e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/nuxt/src/core/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
const nitroConfig: NitroConfig = defu(_nitroConfig, <NitroConfig>{
rootDir: nuxt.options.rootDir,
workspaceDir: nuxt.options.workspaceDir,
srcDir: join(nuxt.options.srcDir, 'server'),
srcDir: nuxt.options.serverDir,
dev: nuxt.options.dev,
preset: nuxt.options.dev ? 'nitro-dev' : undefined,
buildDir: nuxt.options.buildDir,
Expand Down
12 changes: 12 additions & 0 deletions packages/schema/src/config/_common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ export default defineUntypedSchema({
$resolve: async (val, get) => resolve(await get('rootDir'), val || '.')
},

/**
* Define the server directory of your Nuxt application, where Nitro
* routes, middleware and plugins are kept.
*
* If a relative path is specified, it will be relative to your `rootDir`.
*
* @version 3
*/
serverDir: {
$resolve: async (val, get) => resolve(await get('rootDir'), val || resolve(await get('srcDir'), 'server'))
},

/**
* Define the directory where your built Nuxt files will be placed.
*
Expand Down

0 comments on commit 53851e4

Please sign in to comment.