Last updated
Last updated
You can see an example .
This example shows how to set up PurgeCSS with create-react-app template.
craco
Custom PostCSS plugins (including PurgeCSS) can be added to Create React App apps using . Follow the , then install the PurgeCSS
PostCSS plugin and add it to the craco config:
postbuild
Add the following code in package.json
eject
create-react-appInstall the webpack plugin for PurgeCSS:
Now, modify the file config/webpack.prod.conf.js
by adding the following code with the rest of the imports:
...and directly before new ManifestPlugin(...)
in the plugins list, add this:
This example is importing the bootstrap css framework. Without PurgeCSS, the base css file size is 138 kB. Using PurgeCSS, the base css file size is 4 kB
You need to in order to expose the webpack configuration offered by original create-react-app