chuiliu/dev-notes

FormData

Opened this issue · 0 comments

在 create-react-app 中使用antd,配置按需加载组件的代码和样式
安装 babel-plugin-import

yarn add babel-plugin-import

webpack配置文件新增babel-loader配置

options: {
              plugins: [
                ['import', [{
                  libraryName: 'antd',
                  style: 'css'
                }]]
              ],
              // This is a feature of `babel-loader` for webpack (not Babel itself).
              // It enables caching results in ./node_modules/.cache/babel-loader/
              // directory for faster rebuilds.
              cacheDirectory: true,
            },