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: { values: {
'process.env.NODE_ENV': '"production"', 'process.env.NODE_ENV': '"production"',
'typeof window': '"undefined"', '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_BASE': JSON.stringify(config.staticAssets.base),
'process.env.NUXT_STATIC_VERSION': JSON.stringify(config.staticAssets.version), 'process.env.NUXT_STATIC_VERSION': JSON.stringify(config.staticAssets.version),
// @ts-ignore // @ts-ignore

View File

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