You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(react-scripts 2.0.4)
Same as in this issue I am getting a lot of errors from the mini-css-extract-plugin when doing a CI build - which fails since no warnings are allowed.
Since CRA does not allow customizing the WebPack plugin config, I cannot use the warningsFilters and the question about CRA also already popped up.
I am not sure what the CRA team can do about this - but maybe just keep an eye on it (or have it documented as a Known Issue) until WebPack somehow solves it.
PS: for now I am running "set CI=&&react-scripts build" to disable the CI build warnings limit.
stereobooster, mungojam, gonzofish, waliurjs, sapkra and 70 moresni10, DanPurdy and TiagoHA
Are you using 3rd party styling library like antd, bootstrap or anything else?
Like mentioned in the related issue webpack-contrib/mini-css-extract-plugin#250 (comment) the problem should not just be ignored by disabling and hiding the warnings but addressing the source cause instead, its not healthy to have fragile and inconsistent builds.
AndrewBogdanovTSS, FlowerCheng123, designbyadrian, humanbrew, igl and 6 more
@dviry fyi I solved this by importing all CSS from a single file, and for code-split styles I'll migrate to a CSS-in-JS approach (probably Glamorstyled-components).
Yeah, this is a very valid problem. A light change in your code could alter the cascading effects of your CSS, so this is warranted. Maybe some docs on how to fix it would be nice.
AndrewBogdanovTSS, mungojam, giriposhaneshwar, lvl99, noobfe and 33 more
@Timer This seems like more than a documentation problem. I'm working on un-ejecting, but couldn't before 2.0 because of using Sass and CSS modules. Now with 2.0, I'm getting a bunch of these warnings, but we are using CSS modules for everything so there's no chance of the order actually being important (we aren't using any global styles -- just CSS classes).
nbozard, tirli, gonzofish, fwh1990, ryanashcraft and 16 more
In our case, I've worked around this by importing within index.js the components that directly use the CSS files that the warnings were complaining about. This resolves the order ambiguity and in my case, the components are shared pieces that are fine to be in my "main" chunk.
I also have this problem, and the error message is utterly useless and frustrating. On a large project it isn't feasible to randomly start requiring the devs to update their CSS based on arbitrary rules.
I'm using this with SCSS, and I'm even more confused on what it wants from me. The linked issue doesn't help much either.
AndrewBogdanovTSS, merwan7, hawkgs, gonzofish, ryan-ds and 134 more
We use CSS Modules. The problem is in our code, but it is hard to understand what exactly is the issue. It complains about order of css imports in asset graph, but which exactly files?
I also had an issue with the mini-css-extract-plugin warning about a confliction order. Good thing was I'm in complete control of the component library we are using. But finding the correct spot where the problem occurs was really tough. I'm not an expert regarding webpack and neither the mini-css-extract-plugin or any of this. That's why I use CRA in the first place - I don't want to deal in detail with webpack and it's plugin ecosystem.
Nonetheless I was able to fix my component library. I'll just leave this here, so it may be some help to others hopefully.
Before the change:
BaseButton.js
importReactfrom'react';importclassnamesfrom'../../../classnames';import'../../../global/Global.css';import'./BaseButton.css';exportdefaultfunctionBaseButton({ children, type, className, ...other}){return(<buttonclassName={classnames('base-button',className)}type={type}{...other}>{children}</button>);}BaseButton.defaultProps={/** the type of the button */type: 'button'};
When I used the components in that way, the CSS generated on build was not in the order I suspected it to be. When looking at the code of IconButton.js I would assume that the build process would put BaseButton.css before IconButton.css. But in fact it was in the wrong order ... this led to wrongly applied CSS rules (because cascading). And yeah maybe I should move on to use CSS Modules.
Anyway her my solution - even though I can't explain why this works now:
BaseButton.js
importReactfrom'react';importclassnamesfrom'../../../classnames';exportdefaultfunctionBaseButton({ children, type, className, ...other}){return(<buttonclassName={classnames('base-button',className)}type={type}{...other}>{children}</button>);}BaseButton.defaultProps={/** the type of the button */type: 'button'};
Maybe one of you can explain this to me or maybe this even helps you finding a similiar solution on your projects. Just wanted to share ... and this is the first issue I found regarding CRA and mini-css-extract-plugin.
bigkrp, manuelbieh, varren, qaiken, abhimanyuPathania and 54 morerhanything, BrikenaAhmeti, JimLynchCodes, rebotak, arv47x and 3 more
Activity
andriijas commentedon Oct 12, 2018
Are you using 3rd party styling library like antd, bootstrap or anything else?
Like mentioned in the related issue webpack-contrib/mini-css-extract-plugin#250 (comment) the problem should not just be ignored by disabling and hiding the warnings but addressing the source cause instead, its not healthy to have fragile and inconsistent builds.
holloway commentedon Oct 14, 2018
@dviry fyi I solved this by importing all CSS from a single file, and for code-split styles I'll migrate to a CSS-in-JS approach (probably
Glamorstyled-components
).Timer commentedon Oct 15, 2018
Yeah, this is a very valid problem. A light change in your code could alter the cascading effects of your CSS, so this is warranted. Maybe some docs on how to fix it would be nice.
ryancogswell commentedon Oct 19, 2018
@Timer This seems like more than a documentation problem. I'm working on un-ejecting, but couldn't before 2.0 because of using Sass and CSS modules. Now with 2.0, I'm getting a bunch of these warnings, but we are using CSS modules for everything so there's no chance of the order actually being important (we aren't using any global styles -- just CSS classes).
ryancogswell commentedon Oct 22, 2018
In our case, I've worked around this by importing within index.js the components that directly use the CSS files that the warnings were complaining about. This resolves the order ambiguity and in my case, the components are shared pieces that are fine to be in my "main" chunk.
bogdan-calapod commentedon Nov 9, 2018
I also have this problem, and the error message is utterly useless and frustrating. On a large project it isn't feasible to randomly start requiring the devs to update their CSS based on arbitrary rules.
I'm using this with SCSS, and I'm even more confused on what it wants from me. The linked issue doesn't help much either.
stereobooster commentedon Nov 20, 2018
We use CSS Modules. The problem is in our code, but it is hard to understand what exactly is the issue. It complains about order of css imports in asset graph, but which exactly files?
Related webpack-contrib/mini-css-extract-plugin#250
theZieger commentedon Nov 27, 2018
I also had an issue with the mini-css-extract-plugin warning about a confliction order. Good thing was I'm in complete control of the component library we are using. But finding the correct spot where the problem occurs was really tough. I'm not an expert regarding webpack and neither the mini-css-extract-plugin or any of this. That's why I use CRA in the first place - I don't want to deal in detail with webpack and it's plugin ecosystem.
Nonetheless I was able to fix my component library. I'll just leave this here, so it may be some help to others hopefully.
Before the change:
BaseButton.js
IconButton.js
When I used the components in that way, the CSS generated on build was not in the order I suspected it to be. When looking at the code of IconButton.js I would assume that the build process would put BaseButton.css before IconButton.css. But in fact it was in the wrong order ... this led to wrongly applied CSS rules (because cascading). And yeah maybe I should move on to use CSS Modules.
Anyway her my solution - even though I can't explain why this works now:
BaseButton.js
IconButton.js
Maybe one of you can explain this to me or maybe this even helps you finding a similiar solution on your projects. Just wanted to share ... and this is the first issue I found regarding CRA and mini-css-extract-plugin.
gonzofish commentedon Dec 14, 2018
@theZieger what's in
Global.css
?theZieger commentedon Dec 14, 2018
@gonzofish some normalize styles but mostly custom properties (CSS variables)
128 remaining items