Modify hash to history
The added publicPath: '/',
item is to adjust a different server so I made a proxy
module.exports = {
//...
devServer: {
proxy: {
'/': {
target: 'http://localhost:3000',
// 只需要添加该方法,然后当请求的是html,则重定向到index.html
bypass: function (req, res, proxyOptions) {
if (req.headers.accept.indexOf('html') !== -1) {
console.log('Skipping proxy for browser request.');
return '/index.html';
}
},
},
},
},
};
Thanks tree hole ROBOT