-
Notifications
You must be signed in to change notification settings - Fork 512
[webpack v3.0.0] generates CSS in wrong order #548
Comments
Haaaaaaaa I'm not alone. I'm playing with Imagine i've got:
Once it's compiled (it's random), I've got the result like:
which is wrong for me as both define font-size for body, for example. |
Why is a bug set to |
Please stop assigning the entire org team to issues. This is exactly what @evilebottnawi was talking about in slack when he said it makes things confusing. Everyone has a personal projects board, when someone picks up an issue for work they will add it to their personal projects board. |
@cyl19910101 - Can you put that test project back up so I can get this issue sorted? Thanks :) |
@filipesilva FYI this should probably be added to your |
@d3viant0ne that test project is still up: https://github.com/cyl19910101/wp3_test any import statements bringing in css files are not output in the order of the imports |
Thanks, the link in the migrated issue routes to a 404. |
Thanks for the heads up @d3viant0ne, much appreciated 👍 |
Closing this as all issues reported have been resolved & regression tests added.
|
@d3viant0ne great work on that update. The errors seems to be related on CSS Mpdule's
where Below is the configuration:
sidenotes: |
@elrumordelaluz - Throw this in a new issue if you don't mind. |
We still have an issue with this in v3.0.0, which may or may not be solvable. With multiple my_component.css
../css/button_colors.css
../css/buttons.css
With style-loader, the above gets output in this order:
With extract, this is the output:
In effect, this means the primary color is never applied. We can get around this by composing (Note that our classes are a bit more complex than what I've represented here, such that |
@glortho - The specific case for this issue was fixed. If you don't mind, please put the above in a new issue & including something like https://github.com/cyl19910101/wp3_test is immensely helpful with triaging or add a failing test case if you want to skip the boilerplate. In either case, new issue if you would please. |
Sure, sorry about that @d3viant0ne . Stay tuned for new issue. |
@d3viant0ne |
And fun fact : mini-css-extract-plugin doesn't help at all : webpack-contrib/mini-css-extract-plugin#184 |
@kud Do you only have this issue when importing s/css as scss |
I don't know for extract text because people told me to switch to mini css extract since webpack4 but yes, indeed. Importing from JS is better than importing in CSS if you want to keep the order. |
|
Interesting. I was having the same problem using JS imports.. |
But do you use mini css extract? |
No, in this project I'm using webpack 3.x, and no mini css extract. |
I fix the problem but it was a mistake by myself which may some of you are doing. (I am using React so my starting file is index.js and there I load my first component - App.js). I was including the styles after including the App component. I just should load the styles first. [wrong importing] [right importing] Realy stupid mistake. |
@gucomecan, why doesn't components/App import its own styles? |
@jjinux Every component import its own styles, in my opinion that is the right way(reusability). PS: What I mean at first was - in index.js I import my global styles before importing my first component(App.js), otherwise my first components's (and every child of him) styles will be loaded before global styles. Hope that answer your question. :) |
@gucomecan had the same issue xD Thanks for sharing 👍 |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
When using
extract-text-webpack-plugin
with webpack3 to generate stylesheet file, the content's order doesn't obey source code's order. Usecreate-react-app
boilerplate to explain this :Got :
I'm not sure if this problem is webpack3 or
extract-text-webpack-plugin
's problem, since I can get correct result in webpack2.6.1, I think I should post in here first.If the current behavior is a bug, please provide the steps to reproduce.
The complete project : https://github.com/cyl19910101/wp3_test
What is the expected behavior?
Expected stylesheet order :
If this is a feature request, what is motivation or use case for changing the behavior?
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
OS :
Node :
Webpack :
This issue was moved from webpack/webpack#5106 by @sokra. Orginal issue was by @cyl19910101.
extractedChunk.modules.sort
is no longer valid, asextractedChunk.modules
is now a getter toextractedChunk._modules
which is a Set.The text was updated successfully, but these errors were encountered: