Skip to content
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 #57

Closed
PatchOnKnee opened this issue Dec 17, 2018 · 3 comments
Closed

Craco start and craco build causing different css ordering #57

PatchOnKnee opened this issue Dec 17, 2018 · 3 comments

Comments

@PatchOnKnee
Copy link

PatchOnKnee commented Dec 17, 2018

We recently moved over to craco from react-app-rewired, in conjunction with ant-design. However the css is applied differently when running locally compared to running the completed build. Below is the contents of the craco.config.js file.
test
const CracoAntDesignPlugin = require('craco-antd');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const WebpackBar = require('webpackbar');
module.exports = {
plugins: [{ plugin: CracoAntDesignPlugin }],
webpack: {
plugins: [
new WebpackBar({ profile: true }),
],
},
};

Is this the correct way to ensure that the ant-d styles will be applied last, or have I missed something?

@patricklafrance
Copy link
Contributor

Any idea @ndbroadbent ?

@ndbroadbent
Copy link
Contributor

ndbroadbent commented Jan 17, 2019

Hi, I can have a look at this. I've opened a new issue in the craco-antd repo, which might be a better place to discuss that: DocSpring/craco-antd#12

Repository owner deleted a comment from StruggleQueen Jan 18, 2019
@patricklafrance
Copy link
Contributor

Closing this since it's handled in a different repository

kwajiehao added a commit to isomerpages/isomercms-frontend that referenced this issue Jun 17, 2021
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
kwajiehao added a commit to isomerpages/isomercms-frontend that referenced this issue Jun 17, 2021
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants