Issue with purgeCSS with tailwind and Sage 9.0.10

I’m starting a new sage project with Tailwind, but I’ve issues when I’m trying to install purgecss-webpack-plugin

What I did :

composer create-project roots/sage
yarn && yarn build

I had those errors, but I ran the joshuafredrickson solution :

yarn add autoprefixer@^9.8.6 -D
yarn add postcss-loader@~3.0.0 -D

So far, so good. My project works.

Then, I want to use PurgeCSS, and I follow this guide, but when I run yarn add --dev purgecss-webpack-plugin , I have this error and I’m stuck with it…:

error An unexpected error occurred: “could not find a copy of webpack to link in /path_to_my_project/node_modules/purgecss-webpack-plugin/node_modules”.

I tried several fixes, bu nothing works… Can someone help me installing purgecss ?
Thanks a lot !!

I solved my installation. issue : I changed my webpack version inside my package.json from "webpack": "~3.10.0" to "webpack": "^3.0.0"

It seems that the version 3.12 fixed this issue…

But I have another issue : the yarn build:production command is not working anymore : I’ve got this error
TypeError: Cannot read property 'compilation' of undefined

Any idea ?

Ok… so you need to run yarn add --dev purgecss-webpack-plugin@0.23.0, it’s the only version that works…

To sum up (if this can help someone…)

if you want to install purges with the latest sage 9.0.10 version, you should run

yarn add --dev webpack@~3.12.0
yarn add --dev purgecss-webpack-plugin@0.23.0

then do some changes into webpack.config.optimize.js but you can find details here and here

It’s not very straightforward, and documentation should be improved…


This topic was automatically closed after 42 days. New replies are no longer allowed.