在webpack配置中,devserver配置如下:
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
rewrites: [
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
],
}
//其他的省略,暂未列出
}
vue-router配置
const router = new VueRouter({
mode: 'history',
routes: [...]
})