From d74e1a6b254409aa3b5b6d1bd1ed81de9cccf521 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 2 Mar 2018 13:13:56 +0300 Subject: webpack-serve with history api fallback --- vnext/webpack.config.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'vnext/webpack.config.js') diff --git a/vnext/webpack.config.js b/vnext/webpack.config.js index 891a3e53..9eb1d7fa 100644 --- a/vnext/webpack.config.js +++ b/vnext/webpack.config.js @@ -1,3 +1,6 @@ +const history = require('connect-history-api-fallback'); +const convert = require('koa-connect'); + module.exports = { entry: { "vendor": ['react', 'react-dom', 'react-markdown', 'whatwg-fetch'], @@ -17,3 +20,14 @@ module.exports = { ] } }; + +module.exports.serve = { + content: [__dirname], + add: (app, middleware, options) => { + const historyOptions = { + // ... see: https://github.com/bripkens/connect-history-api-fallback#options + }; + + app.use(convert(history(historyOptions))); + } +}; -- cgit v1.2.3