fix(bridge): set app.basePath (#2808)

This commit is contained in:
Daniel Roe 2022-01-19 19:10:33 +00:00 committed by GitHub
parent c1a68012ca
commit 6abf75d40a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -18,6 +18,7 @@ export function setupNitroBridge () {
// Handle legacy property name `assetsPath` // Handle legacy property name `assetsPath`
nuxt.options.app.buildAssetsDir = nuxt.options.app.buildAssetsDir || nuxt.options.app.assetsPath nuxt.options.app.buildAssetsDir = nuxt.options.app.buildAssetsDir || nuxt.options.app.assetsPath
nuxt.options.app.assetsPath = nuxt.options.app.buildAssetsDir 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` // Nitro expects app config on `config.app` rather than `config._app`
nuxt.options.publicRuntimeConfig.app = nuxt.options.publicRuntimeConfig.app || {} nuxt.options.publicRuntimeConfig.app = nuxt.options.publicRuntimeConfig.app || {}
Object.assign(nuxt.options.publicRuntimeConfig.app, nuxt.options.publicRuntimeConfig._app) Object.assign(nuxt.options.publicRuntimeConfig.app, nuxt.options.publicRuntimeConfig._app)

View File

@ -140,7 +140,7 @@ export function getNitroContext (nuxtOptions: NuxtOptions, input: NitroInput): N
generateDir: nuxtOptions.generate.dir, generateDir: nuxtOptions.generate.dir,
publicDir: resolve(nuxtOptions.srcDir, nuxtOptions.dir.public || nuxtOptions.dir.static), publicDir: resolve(nuxtOptions.srcDir, nuxtOptions.dir.public || nuxtOptions.dir.static),
serverDir: resolve(nuxtOptions.srcDir, (nuxtOptions.dir as any).server || 'server'), serverDir: resolve(nuxtOptions.srcDir, (nuxtOptions.dir as any).server || 'server'),
baseURL: nuxtOptions.app.baseURL, baseURL: nuxtOptions.app.baseURL || '/',
buildAssetsDir: nuxtOptions.app.buildAssetsDir, buildAssetsDir: nuxtOptions.app.buildAssetsDir,
isStatic: nuxtOptions.target === 'static' && !nuxtOptions.dev, isStatic: nuxtOptions.target === 'static' && !nuxtOptions.dev,
fullStatic: nuxtOptions.target === 'static' && !nuxtOptions._legacyGenerate, fullStatic: nuxtOptions.target === 'static' && !nuxtOptions._legacyGenerate,