webpack 4 to 5 migration support for closure compiler plugins

226 Views Asked by At

I have a javascript/typescript code using webpack 4 for bundling in this code I am using webpack-closure-compiler plugin when I tried to upgrade to webpack 5 according to the Docs I got the following error [webpack-cli] TypeError: compiler.plugin is not a function and it seems this plugin does not support webpack 5. google did not yield any results that work is there any other sulotion to use closure compiler in webpack 5?

1

There are 1 best solutions below

1
Vivick On

webpack-closure-compiler has been archived in 2019 and does not seem to be compatible with Webpack 5.

An alternative could be to use closure-webpack-plugin, but it doesn't seem compatible with Webpack 5 as it relies on Webpack 4 as a peer dependency.

As mentioned in this Github issue, there hasn't been an update on Webpack 5 support since 2021.

But there's google-closure-library-webpack-plugin as a Webpack 5 alternative to both these plugins.