1.yarn add babel-plugin-import
2.在根目录下的package.json下的bable中添加相应代码
"babel": { "presets": [ "react-app" ], "plugins": [ [ "import", { "libraryName": "antd", "style": "css" // 引入样式为 css // style为true 则默认引入less } ] ] }
3.重启项目yarn run start
本文共 376 字,大约阅读时间需要 1 分钟。
1.yarn add babel-plugin-import
2.在根目录下的package.json下的bable中添加相应代码
"babel": { "presets": [ "react-app" ], "plugins": [ [ "import", { "libraryName": "antd", "style": "css" // 引入样式为 css // style为true 则默认引入less } ] ] }
3.重启项目yarn run start
转载于:https://www.cnblogs.com/lanshu123/p/10662812.html