webpack-serve-addons-history-api-callback

0.0.0 • Public • Published

webpack-serve-addons-history-api-callback

Usage

  1. npm install -D webpack-serve-addons-history-api-callback
  2. 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,
};
  1. 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

Readme

Keywords

none

Package Sidebar

Install

npm i webpack-serve-addons-history-api-callback

Weekly Downloads

14

Version

0.0.0

License

MIT

Unpacked Size

2.82 kB

Total Files

3

Last publish

Collaborators

  • axross