Skip to content

Commit

Permalink
fix: fix issues with router.base support
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 10, 2020
1 parent 65b1bbe commit 5a7e0fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/rollup/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions src/targets/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)}\``)
}
}
}
Expand Down

0 comments on commit 5a7e0fa

Please sign in to comment.