babel-plugin-import icon indicating copy to clipboard operation
babel-plugin-import copied to clipboard

babel-plugin-import is not working with Rollup

Open ViuLive opened this issue 5 years ago • 3 comments

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.

ViuLive avatar May 29 '19 02:05 ViuLive

[
  "import",
  [
    {
      "libraryName": "antd-mobile",
      "style": "css"
    },
    {
      "libraryName": "antd",
      "style": "css"
    }
  ]
]

omitchen avatar Jun 17 '19 07:06 omitchen

image

afc163 avatar Mar 18 '20 03:03 afc163

@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';

dgreene1 avatar Jun 12 '20 14:06 dgreene1