webpack antd 按需加载
2021-05-04 05:27
标签:plugin target 按需加载 name one runtime div bow component 安装babel-plugin-import插件。下面方法二选一,都可以实现antd的按需加载。 一、配置webpack.config.js文件 二、配置babelrc文件 webpack antd 按需加载 标签:plugin target 按需加载 name one runtime div bow component 原文地址:https://www.cnblogs.com/crazycode2/p/12117015.html{
test: /.jsx?$/,
exclude: /(node_modules|bower_components)/,
use: [{
loader: ‘babel-loader‘
}],
options: {
"plugins": [
[
"import", {
"libraryName": "antd",
"style": true
}
]
]
}
}
{
"presets": ["env", "react"],
"plugins": [
"transform-runtime",
"transform-object-rest-spread",
[
"import", {
"libraryName": "antd",
"style": true
}
]
]
}