Skip to content

Commit

Permalink
fix(build): 404.html fallback copying path, close #371
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Oct 11, 2021
1 parent 14d4892 commit 0d2f5ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/slidev/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ export async function build(
}

// copy index.html to 404.html for GitHub Pages
await fs.copyFile(resolve(options.userRoot, 'dist/index.html'), resolve(options.userRoot, 'dist/404.html'))
await fs.copyFile(resolve(config.build.outDir, 'index.html'), resolve(config.build.outDir, '404.html'))
// _redirects for SPA
const redirectsPath = resolve(options.userRoot, 'dist/_redirects')
const redirectsPath = resolve(config.build.outDir, '_redirects')
if (!fs.existsSync(redirectsPath))
await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200\n`, 'utf-8')

Expand Down

0 comments on commit 0d2f5ba

Please sign in to comment.