Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack v5 support #161

Open
jurassix opened this issue Mar 16, 2021 · 8 comments
Open

webpack v5 support #161

jurassix opened this issue Mar 16, 2021 · 8 comments

Comments

@jurassix
Copy link

馃憢 I'm interested in using GCC with the latest version of Webpack (v5) but there seems to be an internal plugin issue. So far I've upgraded the demos to the latest dependency versions and included the error below. I've also checked to see if there is a v5 working branch but didn't see one. I'm happy to contribute to help get the latest webpack version supported but unsure if there is already work in-progress. Thanks for your time.

I get the following error after upgrading the es5-and-es6 demo:

master:~/sandbox/closure-webpack-plugin/demo/es5-and-es6$ npm run start

> [email protected] start /Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6
> webpack serve --mode=production

/Users/clint/sandbox/closure-webpack-plugin/src/closure-compiler-plugin.js:197
      compilation.dependencyTemplates.forEach((val, key) => {
                                      ^

TypeError: compilation.dependencyTemplates.forEach is not a function
    at ClosureCompilerPlugin.compilation_ (/Users/clint/sandbox/closure-webpack-plugin/src/closure-compiler-plugin.js:197:39)
    at /Users/clint/sandbox/closure-webpack-plugin/src/closure-compiler-plugin.js:159:12
    at _next31 (eval at create (/Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:42:1)
    at _next9 (eval at create (/Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:97:1)
    at Hook.eval [as call] (eval at create (/Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:119:1)
    at Hook.CALL_DELEGATE [as _call] (/Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/tapable/lib/Hook.js:14:14)
    at Compiler.newCompilation (/Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/webpack/lib/Compiler.js:993:26)
    at /Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/webpack/lib/Compiler.js:1035:29
    at Hook.eval [as callAsync] (eval at create (/Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/tapable/lib/Hook.js:18:14)
    at Compiler.compile (/Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/webpack/lib/Compiler.js:1030:28)
    at /Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/webpack/lib/Watching.js:132:19
    at Hook.eval [as callAsync] (eval at create (/Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/tapable/lib/Hook.js:18:14)
    at run (/Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/webpack/lib/Watching.js:86:33)
    at /Users/clint/sandbox/closure-webpack-plugin/demo/es5-and-es6/node_modules/webpack/lib/Watching.js:82:6
@dtzxporter
Copy link

I've investigated this, and the API for WP5 has changed a bit, and a lot of the changes this plugin makes would be considered 'hacks' around the API. I spent a little bit hacking them back into place but honestly it would likely be better for someone to do it from scratch rather than modify this plugin.

@ChadKillingsworth
Copy link
Member

As you noticed, in many ways this plugin has had to work around limitations in extending webpack. Every major version update of webpack equates to many many hours of testing and dev work.

While I'd like to support webpack 5, right now I just don't have the time to devote to that endeavor.

@evenstensberg
Copy link
Member

Is there anything from a webpack side of things you need help with?

@xnerhu
Copy link

xnerhu commented Jul 31, 2021

Is there any update on this?

@Mistic92
Copy link

Hi, we migrated to webpack 5 and would be neat to have support of this plugin

@mhassan1
Copy link

mhassan1 commented Aug 10, 2022

This alternative did the trick for me: https://www.npmjs.com/package/google-closure-library-webpack-plugin

bennorth added a commit to pytchlang/pytch-vm that referenced this issue Jan 17, 2023
This involves webpack itself, its CLI, and then various plugins:

    clean-webpack-plugin
    compression-webpack-plugin
    copy-webpack-plugin
    eslint-webpack-plugin (replaces eslint-loader)

It seems there is no closure-webpack-plugin release for webpack 5 (see
webpack-contrib/closure-webpack-plugin#161),
so try webpack's default minimiser, terser, instead.  Results are that
build times are comparable, and runtime for the complete set of unit
tests is c.1% slower.

Cuts down number of packages installed, from

    added 742 packages, and audited 743 packages

to

    added 449 packages, and audited 450 packages

Also gets rid of various deprecation warnings:

    [email protected]: See
    https://github.com/lydell/source-map-url#deprecated

    [email protected]: Please see https://github.com/lydell/urix#deprecated

    [email protected]: This loader has been deprecated. Please use
    eslint-webpack-plugin

    [email protected]:
    https://github.com/lydell/resolve-url#deprecated

    [email protected]: See
    https://github.com/lydell/source-map-resolve#deprecated

    [email protected]: Chokidar 2 does not receive security updates since
    2019.  Upgrade to chokidar 3 with 15x fewer dependencies

    [email protected]: The querystring API is considered Legacy. new
    code should use the URLSearchParams API instead.

    [email protected]: Please upgrade to version 7 or higher.  Older versions
    may use Math.random() in certain circumstances, which is known to
    be problematic.  See https://v8.dev/blog/math-random for details.

Breakages in build will be addressed in commits to follow.
@avindra
Copy link

avindra commented Aug 30, 2023

Using:

npm install --legacy-peer-deps

allows me to use webpack 5. would be nice to have this in the repo, though.

@Forux
Copy link

Forux commented Apr 25, 2024

https://www.npmjs.com/package/google-closure-library-webpack-plugin does not have even example of how to use it

Any updates on webpack v5?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants