Errors when importing antd.less using less-loader #7850
Comments
You mean |
@afc163 Exactly. When I rollback to less@2.7.1. Everything goes well. Thanks for your early reply in such a off-duty time. It really bothers me some of days. |
It is more like a less@3 issue. |
BTW, importing antd.less will import all the components' style files, which will naturally lead a big size of buddle. The scheme using |
I will keep this open for people who run into same problem until next less alpha version fix it. |
我也遇到了同样的问题 |
@javaLuo It's a bug of less@3.0.0-alpha.3. For more informations, see less issues#3113. As for your question, I have give a solution as there-in-before. You could add a 目前还是less@3.0.0-alpha.3的一个bug,关于less那边讨论与反馈可以移步这里less issues#3113. 至于你的问题,我在上文已经给出过一个解决方案了,可以通过给项目添加 |
@Coodool Thanks! |
Using CRA, after ejecting, and configuring babel-plugin-import in the babel-loader, and adding the less-loader, I got the same problem. I really need to override less variables. Using "style": "css" option is not solution for me :( |
same here as @taviroquai. Seems that employing the I still see:
in my console. :| |
rollback to less@2.7.1 solved for me - using with create-react-app |
Faced the same problem, this little guy stumped me for an entire night. Unfortunately for me, I discovered this thread after fixing the issue myself. It would be really helpful if you guys could add this as a tip in "Customize Theme" section of the docs, just until less team fixes this issue. |
when i use create-react-app with antd, and use
rollback less to 2.7.2, it's ok. thanks @afc163 |
Rollback less to 2.7.2, works for me too, crash into this with an ejected create-react-app project. |
add .less to extensions in your webpack definition config file: |
Will it be backported to 2.x branch? |
Note that the preferred solution in Less is to use plugins - See |
What fixed my ejected, reconfigured
|
Is this still an issue with Less v3.5.0-beta? ( |
Alternatively, is this an issue with the option |
Ideally, we would resolve this on the Less side. But it may just be a configuration issue ( |
@matthew-dean Both |
@Tymek Great! That would be the preferred approach vs. downgrading. But if the Less team can help in other ways, or if |
use // webpack.config.js
...
plugins: [
new CaseSensitivePathsPlugin(),
...
] |
Had this issue on windows setups only, was due to the less-loader rule having a "include" option configured that didn't work the same way on windows. Hope that helps someone else from going down the rabbit hole with other suggested solutions that don't help. |
Version
antd @2.13.4
webpack @3.6.0
less @3.0.0
less-loader @4.0.5
Describe
I'm importing antd.less into my antd project built with wepack. Follow the direction of official doc in the Customize Theme. I create a standalone less file and import the antd.less as follows:
But when I run
npm start
, an error occurys:The first thought in my head is there must be something goes wrong with webpack or less-loader, so I have tried a lot in configuring my webpack.config.js. But that seems doesn't work.
I try to compile the antd.less directly in the CLI:
Still goes wrong. So I guess it may be an antd issues:
Solution
The way on my searching a solution for the issue, I found another workaround to import antd style in my project, which using
babel-plugin-import
and add such a config items in the .babelrc file:Thongh it works, I still wonder why the official scheme doesn't go as expected.
Here is my webpack configuration.
The text was updated successfully, but these errors were encountered: