1.问题描述
2.出现原因
package.json依赖的插件版本与现在umi版本发生冲突,具体如下所示:
{
"name": "umi-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "umi dev",
"build": "umi build"
},
"author": "",
"license": "ISC",
"dependencies": {
"antd": "^3.13.0",
"axios": "^0.18.0",
"umi-plugin-react": "^1.4.2"
}
}
而Umi3中发生了以下修改:
3.解决办法
(1)修改package.json
{
"name": "umi-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "umi dev",
"build": "umi build"
},
"author": "",
"license": "ISC",
"dependencies": {
"antd": "^3.13.0",
"axios": "^0.18.0",
"@umijs/preset-react": "^1.4.2"
}
}
(2)修改config.js
修改前:
export default {
plugins: [
[
"umi-plugin-react",
{
antd: true,
dva: true
}
]
],
routes: [
//+++
]
};
修改后:
export default {
dva:{},
antd:{},
routes: [
//+++
]
};