How to use .babelrc to download babel-plugin-import for antd?

I am new to reaction, babel and antd.

I installed the reaction and started the project using the create-react-app. I installed antd (ant.design). He suggests using babel-plugin imports, so I installed it too.

If I interpret it correctly, the usage documentation for babel-plugin-import says to put this in a .babelrc file:

{
  "plugins": [
    ["import", {
      "libraryName": "antd",
      "style": true
    }]
  ]
}

I have problems with work. My web console still has a warning:

You are using the whole antd package, please use https://www.npmjs.com/package/babel-plugin-import to reduce the number of applications in size.

.babelrc , ( npm). , myProject/ node_modules/babel_plugin_import, .

?

https://github.com/ant-design/babel-plugin-import

babel-plugin-import , webpack config vender.

, .

: antd , create-response-app? , - , create-react-app?

+4
1

[ 2018-02-06: - , , react-app-rewired. .]

https://ant.design/docs/react/use-with-create-react-app#Import-on-demand T.

ant .babelrc . CRA babel webpack.

, babel-plugin-import.

: npm run eject

config webpack dev/prod.

, plugins, .

+4

Source: https://habr.com/ru/post/1677392/


All Articles