umijs / babel-plugin-import

Modularly import plugin for babel.
3.16k stars 404 forks source link

babel-plugin-import is not working with Rollup #325

Open ViuLive opened 5 years ago

ViuLive commented 5 years ago

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.

omitchen commented 5 years ago
[
  "import",
  [
    {
      "libraryName": "antd-mobile",
      "style": "css"
    },
    {
      "libraryName": "antd",
      "style": "css"
    }
  ]
]
afc163 commented 4 years ago
image
dgreene1 commented 4 years ago

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