Replies: 1 comment
-
I modified the code to append the loader for PostCSS at the back of the arrays for each interested oneOf rule. This still doesn't work, I suspect it's because the existing rules already have a loader for PostCSS that is set by Next in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I'm trying to setup a project with css modules and I'd like to use PurgeCSS to clean up unused css. I setup the plugin in a
postcss.config.mjs
file, but while "normal" css is purged as intended css modules are not.PurgeCSS website has an old example on how to set it up for CSS modules in CRA. I'm not really proficient in Webpack but it looks like the idea is to make sure that the CSS modules hashes are computed before PostCSS runs.
If that's the case I think it should be possibile to do it in Next, but I'm not sure how the webpack configuration should look like, the
next.config.mjs
below should work as far as I understand, but unused classes are not purged in "normal" CSS files nor in hashed CSS modules.How can I make sure the CSS modules hashes are computed before the PostCSS run? and How can I setup PostCSS from the
webpack
option of the next config file?Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions