diff options
author | Vitaly Takmazov | 2018-03-02 13:13:56 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:52 +0300 |
commit | d74e1a6b254409aa3b5b6d1bd1ed81de9cccf521 (patch) | |
tree | bffb49d9f632b2370d21b892bfeec3037cb91d25 | |
parent | 3338a0d36015752e94bd9009b75f47d92268a35f (diff) |
webpack-serve with history api fallback
-rw-r--r-- | vnext/package.json | 2 | ||||
-rw-r--r-- | vnext/webpack.config.js | 14 | ||||
-rw-r--r-- | vnext/yarn.lock | 8 |
3 files changed, 24 insertions, 0 deletions
diff --git a/vnext/package.json b/vnext/package.json index 913fc432..d7e457ab 100644 --- a/vnext/package.json +++ b/vnext/package.json @@ -16,8 +16,10 @@ "babel-loader": "^7.1.3", "babel-preset-env": "^1.6.1", "babel-preset-react": "^6.24.1", + "connect-history-api-fallback": "^1.5.0", "css-loader": "^0.28.10", "file-loader": "^1.1.11", + "koa-connect": "^2.0.1", "prop-types": "^15.6.1", "react-hot-loader": "^4.0.0", "style-loader": "^0.20.2", 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))); + } +}; diff --git a/vnext/yarn.lock b/vnext/yarn.lock index 487b143e..0883e7ad 100644 --- a/vnext/yarn.lock +++ b/vnext/yarn.lock @@ -1554,6 +1554,10 @@ configstore@^3.0.0: write-file-atomic "^2.0.0" xdg-basedir "^3.0.0" +connect-history-api-fallback@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz#b06873934bc5e344fef611a196a6faae0aee015a" + console-browserify@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" @@ -3379,6 +3383,10 @@ koa-compose@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/koa-compose/-/koa-compose-4.0.0.tgz#2800a513d9c361ef0d63852b038e4f6f2d5a773c" +koa-connect@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/koa-connect/-/koa-connect-2.0.1.tgz#2acad159c33862de1d73aa4562a48de13f137c0f" + koa-convert@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/koa-convert/-/koa-convert-1.2.0.tgz#da40875df49de0539098d1700b50820cebcd21d0" |