webpack配置antd的按需加载

匿名 (未验证) 提交于 2019-12-02 22:56:40

安装babel-plugin-import插件。下面方法二选一,都可以。

一、配置webpack.config.js文件

{     test: /.jsx?$/,     exclude: /(node_modules|bower_components)/,     use: [{         loader: ‘babel-loader‘     }],     options: {         "plugins": [             [                 "import", {                     "libraryName": "antd",                     "style": true                 }             ]         ]     } }

二、配置babelrc文件

{   "presets": ["env", "react"],   "plugins": [     "transform-runtime",     "transform-object-rest-spread",     [       "import", {         "libraryName": "antd",         "style": true       }     ]   ] }

原文:https://www.cnblogs.com/camille666/p/webpack_antd.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!