目的是解决开发SPA多路由应用时,在不修改nginx配置的前提下防止出现刷新404的问题
npm install multi-page-refresh-plugin --save-dev
//引入
const MultiPageRefreshPlugin = require('multi-page-refresh-plugin');
//增加配置
plugins:[
new MultiPageRefreshPlugin({
routes: [{
path:'/test1'
},
{
path:'/test2'
} ,
...
]
}),
]
name | type | default | Description |
---|---|---|---|
routers | Array | [] | 路由配置数组 |
PS: html文件的必须是
index.html
,否则会识别不到html文件