Webpack-dev-server
lastmod 2022-08-10created 2020-09-266 edits
Serves a webpack app. Updates the browser on changes.
watchFiles
You can configure a list of globs/directories/files to watch for file changes. For example:
webpack.config.js:
historyApiFallback
Use the Fallback option when, as with Vue Router#HTML5 history mode, an SPA accesses /path/home but should return the contents of index.html.
For finer control:
module.exports = {
//...
devServer: {
historyApiFallback: {
rewrites: [
{
from: new RegExp(publicPath.replaceAll('/', '\\/') + '.*'),
to: publicPath + 'index.html',
},
],
},
},
};
proxy
Use this to route specific paths to another server.
module.exports = {
// ...
devServer: {
proxy: {
'^/plugins': {
target: 'http://localhost:20000',
changeOrigin: true,
},
},
},
};