通过 babel-plugin-import 配置处理。 { "plugins": [ ["import", { "libraryName": "antd", "libraryDirectory": "es", "style": "css" }] ] } 相当于 import Button from 'antd/es/button'; import 'antd/es/button/style/css'; 你可以自行查看node_modules/antd下的相关文件。
通过
babel-plugin-import
配置处理。相当于
你可以自行查看
node_modules/antd
下的相关文件。