Roots Discourse

Could not find a copy of webpack to link to

Hi all. Trying to add purgecss-webpack-plugin to my Sage setup but I keep getting the following error when I run yarn build:

error An unexpected error occurred: "could not find a copy of webpack to link in /home/user/code/bb/wp-content/themes/sage/node_modules/purgecss-webpack-plugin/node_modules".

It looks like yarn is trying to find webpack in the purgecss-webpack-plugin directory. Does anyone know how I can point the plugin at Sage’s version of node_modules?

Thanks