From 6abf75d40ab2e3a62f2f590db6ec01482e5607c3 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 19 Jan 2022 19:10:33 +0000 Subject: [PATCH] fix(bridge): set `app.basePath` (#2808) --- packages/bridge/src/nitro.ts | 1 + packages/nitro/src/context.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/bridge/src/nitro.ts b/packages/bridge/src/nitro.ts index 97abf9fd6b..54a5598913 100644 --- a/packages/bridge/src/nitro.ts +++ b/packages/bridge/src/nitro.ts @@ -18,6 +18,7 @@ export function setupNitroBridge () { // Handle legacy property name `assetsPath` nuxt.options.app.buildAssetsDir = nuxt.options.app.buildAssetsDir || nuxt.options.app.assetsPath nuxt.options.app.assetsPath = nuxt.options.app.buildAssetsDir + nuxt.options.app.baseURL = (nuxt.options.app as any).basePath // Nitro expects app config on `config.app` rather than `config._app` nuxt.options.publicRuntimeConfig.app = nuxt.options.publicRuntimeConfig.app || {} Object.assign(nuxt.options.publicRuntimeConfig.app, nuxt.options.publicRuntimeConfig._app) diff --git a/packages/nitro/src/context.ts b/packages/nitro/src/context.ts index 9f2cbefedd..bb13c97f22 100644 --- a/packages/nitro/src/context.ts +++ b/packages/nitro/src/context.ts @@ -140,7 +140,7 @@ export function getNitroContext (nuxtOptions: NuxtOptions, input: NitroInput): N generateDir: nuxtOptions.generate.dir, publicDir: resolve(nuxtOptions.srcDir, nuxtOptions.dir.public || nuxtOptions.dir.static), serverDir: resolve(nuxtOptions.srcDir, (nuxtOptions.dir as any).server || 'server'), - baseURL: nuxtOptions.app.baseURL, + baseURL: nuxtOptions.app.baseURL || '/', buildAssetsDir: nuxtOptions.app.buildAssetsDir, isStatic: nuxtOptions.target === 'static' && !nuxtOptions.dev, fullStatic: nuxtOptions.target === 'static' && !nuxtOptions._legacyGenerate,