-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Craco start and craco build causing different css ordering #12
Comments
@PatchOnKnee This config looks correct to me, but this is probably a bug. There are a few differences between the dev and prod config, but I'm not sure why those would change the order of the CSS.
I think it would make sense to apply the ant-d CSS first, so that you can override it with your own custom CSS? Sorry I'm not sure if I fully understand the issue. |
@ndbroadbent I can confirm that this is definitely due to the stylesheet chunks being injected in the wrong order during build. I'm assuming this has something to do with the less loader, but can't really seem to spot the issue |
Actually this is more likely related to miniCssExtractt. I also don't think the plugin options are properly modifying the loader rules for build. For example, when I experiment and modify the chunkFilename option for miniCssExtractPLuginOptions, it has no affect on the build output. |
Hi, I am facing same! After building, I have to change order of links to stylesheets manually in index.html to make things work correctly... Regards |
Hi everyone, I've started looking into this but am having some problems reproducing the issue. I've created a test-app and a puppeteer test that builds the production assets, serves them, opens up the page in Chrome, and checks that the CSS overrides are working properly. It also clicks a button to make sure that a counter state increments. Could someone please take a look at this puppeteer test and let me know how I can reproduce this CSS ordering issue? Thanks! (I'm also working on #10, to get the jest tests working for |
I'm just leaving my notes here for potential weary travelers! I encountered a related issue to this CSS ordering warning coming from MiniCssExtractPlugin. The warnings were making my CI fail, but the app worked fine. I decided to suppress the warnings, as outlined here: https://github.com/webpack-contrib/mini-css-extract-plugin/blob/v0.8.0/README.md#remove-order-warnings However, MiniCssExtractPlugin already exists in the original webpack config, so I had to replace it with a new one, with ignoreOrder set to true. My final craco.config.js looks like this:
I'd love a better way of targeting the original MiniCss plugin to remove it than the naive filter I used - but this was a 1am decision after many hours trying to resolve the issue - happy to hear a better way. Hope this helps someone! |
Very helpful. I didn't even have time to become a weary traveler! |
This is a hope that is bug will be resolved ? |
This reverts commit 17276df. We are reverting PR #511 because we found out that the outputs of `craco start` and `craco build` were different, resulting in CSS files being imported in an order different to what is intended. The workarounds we found online were convoluted and would introduce unnecessary complexity to the repo. Furthermore, we also found a library (react-app-rewire-alias) which can help us achieve aliasing with CRA as an alternative to Craco. In addition to the bug associated with Craco here, Craco is also overkill since it's a powerful tool which helps users to extend their default CRA configs for webpack among other things. As such, we are reverting this commit and will be attempting to reintroduce aliases at a later date. A sample of how to use react-app-rewire-alias can be found in the vaccinegovsg repo https://github.com/datagovsg/vaccinegovsg-clinic/blob/dev/frontend/config-overrides.js References: - dilanx/craco#57 - DocSpring/craco-antd#12
* Revert "style: introduce aliasing, sort imports (#511)" This reverts commit 17276df. We are reverting PR #511 because we found out that the outputs of `craco start` and `craco build` were different, resulting in CSS files being imported in an order different to what is intended. The workarounds we found online were convoluted and would introduce unnecessary complexity to the repo. Furthermore, we also found a library (react-app-rewire-alias) which can help us achieve aliasing with CRA as an alternative to Craco. In addition to the bug associated with Craco here, Craco is also overkill since it's a powerful tool which helps users to extend their default CRA configs for webpack among other things. As such, we are reverting this commit and will be attempting to reintroduce aliases at a later date. A sample of how to use react-app-rewire-alias can be found in the vaccinegovsg repo https://github.com/datagovsg/vaccinegovsg-clinic/blob/dev/frontend/config-overrides.js References: - dilanx/craco#57 - DocSpring/craco-antd#12 * lint: correct linting error
From: dilanx/craco#57
The text was updated successfully, but these errors were encountered: