babel-plugin-import
babel-plugin-import copied to clipboard
babel-plugin-import is not working with Rollup
I get this error (You are using a whole package of antd-mobile, please use https://www.npmjs.com/package/babel-plugin-import to reduce app bundle size) on the console. As you mentioned in the documents, I've installed babel-plugin-import and add below code to the .babelrc file
"plugins": [
["import", { "libraryName": "antd", "libraryDirectory": "es", "style": "css" }],
["import", { "libraryName": "antd-mobile","libraryDirectory": "es", "style": "css" }, "antd-mobile"]
],
The issue is I still get that error on console. I'm using Rollup as bundler.
[
"import",
[
{
"libraryName": "antd-mobile",
"style": "css"
},
{
"libraryName": "antd",
"style": "css"
}
]
]
![image](https://user-images.githubusercontent.com/507615/76923038-4cab2f80-690d-11ea-8cf8-740ccd57e3a6.png)
@ViuLive is it possible that you're still importing the big file somewhere? If so please delete this:
@import '~antd/dist/antd.css';
or if you're doing it in JS/TS, delete this:
import '~antd/dist/antd.css';