From 81fcc70ecab25566148631237d39e60cfb9f6ef8 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 18 Aug 2017 21:01:55 +0430 Subject: [PATCH] don't overwrite if 200.html already exists --- lib/builder/generator.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/builder/generator.js b/lib/builder/generator.js index 7b83eac0c7..950ee46b52 100644 --- a/lib/builder/generator.js +++ b/lib/builder/generator.js @@ -73,6 +73,13 @@ export default class Generator extends Tapable { })) } + // Copy /index.html to /200.html for surge SPA + // https://surge.sh/help/adding-a-200-page-for-client-side-routing + const _200Path = join(this.distPath, '200.html') + if (!existsSync(_200Path)) { + await copy(join(this.distPath, 'index.html'), _200Path) + } + const duration = Math.round((Date.now() - s) / 100) / 10 debug(`HTML Files generated in ${duration}s`)