0.0.0 • Published 6 years ago
webpack-serve-addons-history-api-callback v0.0.0
webpack-serve-addons-history-api-callback
Usage
npm install -D webpack-serve-addons-history-api-callback
- Add the following to your
webpack-serve
config
example of serve.config.js
const historyApiFallbackAddon = require('webpack-serve-addons-history-api-callback').addon;
module.exports = {
config: './webpack.config.js',
content: './public',
add: historyApiFallbackAddon,
};
- Run
webpack-serve
Use with other addons/middlewares
example of serve.config.js
const historyApiFallback = require('webpack-serve-addons-history-api-callback');
module.exports = {
config: './webpack.config.js',
content: './public',
add: (app, middleware, options) => {
app.use(anotherAddon());
app.use(historyApiFallback());
},
};
Options
app.use(historyApiFallback({ /* options */ }));
See: https://github.com/bripkens/connect-history-api-fallback#options
There's frequently used options in the following.
Option | Type | Default value | Description |
---|---|---|---|
index | string | /index.html | Override the index |
rewrites | { from: string, to: string }[] | Override the index when the request url matches a regex pattern | |
htmlAcceptHeaders | string[] | ['text/html', '*/*'] | Override the default accepts request headers |
0.0.0
6 years ago