If anyone else is getting this error with Webpack 3 and purgeCSS:
TypeError: Cannot read property 'compilation' of undefined
Then you need to use purgeCSS version compatible with Webpack 3:
yarn add [email protected] -D
Another tip.
cssnanoConfig inside postcss.config.js is set to remove all comments and that prevents whitelisting directly within SCSS files. So just set to use default preset:
const cssnanoConfig = { preset: ['default'] };
Now just mark comments as important /*! purgecss ignore */ and cssnano will leave them be.