Giter Site home page Giter Site logo

Comments (17)

hust419 avatar hust419 commented on May 13, 2024 5

babel-plugin-antd 的文档也太简单了,完全不知所云。
依然搞不清楚,为什么会出现这个提示? 为什么要有这个提示。
为什么要用babel-plugin-antd,用了有什么好处
怎么用babel-plugin-antd...... 一堆疑问

from babel-plugin-import.

FairyRoc avatar FairyRoc commented on May 13, 2024 2

您好,使用babel-plugin-import的时候经常会有一个问题:当我加载一个子Component的时候,它会引起import插件的自动加载style功能,例如import {Menu,SubMenu} from 'antd',就会报错sub-menu/style不存在,请问有什么方法解决吗?谢谢

from babel-plugin-import.

sorrycc avatar sorrycc commented on May 13, 2024

@afc163 这个提示是根据什么判断做出的?

from babel-plugin-import.

pigcan avatar pigcan commented on May 13, 2024

同问

from babel-plugin-import.

afc163 avatar afc163 commented on May 13, 2024

https://github.com/ant-design/ant-design/blob/master/index.js

走这个文件就会出现,直接 import 'antd/lib/xxx' 或是用了 babel-plugin-antd 就不会出现,楼主应该是不会配置 babel-plugin

from babel-plugin-import.

afc163 avatar afc163 commented on May 13, 2024

#18

from babel-plugin-import.

hong26 avatar hong26 commented on May 13, 2024

@afc163 我也知道直接 import 'antd/lib/xxx',不会出现提示,但问题是这样做的话引用的组件一多就非常麻烦了,所以才想问问怎么使用babel-plugin-antd。具体要配置哪里呢?

from babel-plugin-import.

Catlite91 avatar Catlite91 commented on May 13, 2024

报错:Module build failed: Error: Plugin 1 specified in "/Users/panda/workspace/olympus/mobile/.babelrc" provided an invalid property of "style"

.babelrc添加配置:
"plugins": [
"antd", {"style": true}
]
请问是这么配置么?

from babel-plugin-import.

guimuv5 avatar guimuv5 commented on May 13, 2024

同问

from babel-plugin-import.

afc163 avatar afc163 commented on May 13, 2024

https://github.com/ant-design/babel-plugin-antd#usage

from babel-plugin-import.

hong26 avatar hong26 commented on May 13, 2024

前两天一直在忙着研究组件,今天再看了一下,终于把问题解决了.按官方文档先安装babel-plugin-antd,然后在webpack.config.js的loaders里面jsx这一项添加一个plugins: [['antd', {style:'css'}]],就可以了.希望对有相同问题的同学有用.

from babel-plugin-import.

Witee avatar Witee commented on May 13, 2024

还是不能用,报错:
Module build failed: TypeError: The plugin ["antd",{"style":"css"}] didn't export a Plugin instance

from babel-plugin-import.

Witee avatar Witee commented on May 13, 2024

我当时的解决办法是 babel 版本升级到6以上,之前用的是5,但随之会引来新的问题,google 后解决

from babel-plugin-import.

freyhill avatar freyhill commented on May 13, 2024

同问呀

from babel-plugin-import.

lcoder avatar lcoder commented on May 13, 2024

@hust419 对的,完全搞不清楚这个插件是干嘛的。

from babel-plugin-import.

biggeryan avatar biggeryan commented on May 13, 2024

https://ant.design/docs/react/getting-started-cn 文档里面有说明的

from babel-plugin-import.

hansinhu avatar hansinhu commented on May 13, 2024

Note:
babel-plugin-import will be not working if you add the library in webpack config vendor.

from babel-plugin-import.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.