From a3dc0be30dea6d83d806290afbba005712ba1e06 Mon Sep 17 00:00:00 2001 From: Daniel Vassallo Date: Thu, 24 Oct 2019 22:36:00 -0700 Subject: [PATCH] Add URL rewrites in webpack-dev-server --- webpack.config.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 17680cf..93f07ca 100755 --- a/webpack.config.js +++ b/webpack.config.js @@ -93,12 +93,20 @@ module.exports = (env, argv) => { config.devServer = { watchContentBase: true, - historyApiFallback: true, hot: true, inline: true, - host: '0.0.0.0', - port: 3000 + port: 3000, + historyApiFallback: { + rewrites: [ + { + from: /^\/.*$/, + to: function (context) { + return '/' + context.parsedUrl.pathname + '.html'; + } + } + ] + } } config.plugins.push(new webpack.HotModuleReplacementPlugin())