fix: fix issues with router.base support

This commit is contained in:
Pooya Parsa 2020-11-11 00:04:33 +01:00
parent dc6154fea8
commit 4f74119739
2 changed files with 7 additions and 7 deletions

View File

@ -76,6 +76,7 @@ export const getRollupConfig = (config: SLSOptions) => {
values: {
'process.env.NODE_ENV': '"production"',
'typeof window': '"undefined"',
'process.env.ROUTER_BASE': JSON.stringify(config.routerBase),
'process.env.NUXT_STATIC_BASE': JSON.stringify(config.staticAssets.base),
'process.env.NUXT_STATIC_VERSION': JSON.stringify(config.staticAssets.version),
// @ts-ignore

View File

@ -28,14 +28,13 @@ if ('serviceWorker' in navigator) {
'template:document' (tmpl) {
tmpl.compiled = tmpl.compiled.replace('</body>', script + '</body>')
},
async done ({ targetDir, publicDir }) {
const rootIndex = resolve(publicDir, 'index.html')
const rootFallback = resolve(publicDir, '200.html')
if (!existsSync(rootIndex) && existsSync(rootFallback)) {
await copy(rootFallback, rootIndex)
async done ({ rootDir, publicDir }) {
const fallback200 = resolve(publicDir, '200.html')
const fallback400 = resolve(publicDir, '400.html')
if (!existsSync(fallback400) && existsSync(fallback200)) {
await copy(fallback200, fallback400)
}
consola.info(`Try with \`npx serve ${relative(process.cwd(), targetDir)}\``)
consola.info(`Try with \`nuxt start ${relative(process.cwd(), rootDir)}\``)
}
}
}