Skip to content

Instantly share code, notes, and snippets.

@c10r
Created May 27, 2020 20:29
Show Gist options
  • Save c10r/4153af6658c99b5101033491ace867f7 to your computer and use it in GitHub Desktop.
Save c10r/4153af6658c99b5101033491ace867f7 to your computer and use it in GitHub Desktop.
Add purgeCSS to the list of style loaders
{
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebook/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
autoprefixer: {
flexbox: 'no-2009',
},
stage: 3,
}),
postcssNormalize(),
purgecss, // <---- THIS PART IS NEW
],
sourceMap: isEnvProduction && shouldUseSourceMap,
},
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment