fix(nuxt3): avoid #_config app import in dev mode (#3896)

This commit is contained in:
Daniel Roe 2022-03-25 11:38:36 +00:00 committed by GitHub
parent e72e6d0d0f
commit dc1064f79a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,7 +179,7 @@ export const publicPathTemplate: NuxtTemplate = {
getContents ({ nuxt }) {
return [
'import { joinURL } from \'ufo\'',
'import config from \'#_config\'',
!nuxt.options.dev && 'import config from \'#_config\'',
nuxt.options.dev
? `const appConfig = ${JSON.stringify(nuxt.options.app)}`
@ -194,6 +194,6 @@ export const publicPathTemplate: NuxtTemplate = {
' const publicBase = appConfig.cdnURL || appConfig.baseURL',
' return path.length ? joinURL(publicBase, ...path) : publicBase',
'}'
].join('\n')
].filter(Boolean).join('\n')
}
}