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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to webpack5 #944

Open
AyoyimikaAjibade opened this issue Jan 18, 2022 · 6 comments
Open

Migration to webpack5 #944

AyoyimikaAjibade opened this issue Jan 18, 2022 · 6 comments

Comments

@AyoyimikaAjibade
Copy link

AyoyimikaAjibade commented Jan 18, 2022

Please update node-forge to migrate to webpack5 as maintaining it in the Debian OS environment caused a bug as we try to build the package with webpack 5.65.0 after updating node-forge webpack.config files to use webpack5 options , as you still support of webpack4.44.1
here is a link to the bug report https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1002861

The failing build output looks like this while building with webpack 5.65.0

webpack --progress
99% cache shutdownasset forge.js 662 bytes [emitted] (name: forge)

ERROR in forge
Module not found: Error: Recursion in resolving
Stack:
  undefined: (/home/ayoyimika/debian-js-packaging/forge/node-node-forge) ./lib/index.js

webpack 5.65.0 compiled with 1 error in 628 ms

assets by status 0 bytes [cached] 1 asset

ERROR in forge
Module not found: Error: Recursion in resolving
Stack:
  undefined: (/home/ayoyimika/debian-js-packaging/forge/node-node-forge) ./lib/index.js

webpack 5.65.0 compiled with 1 error in 776 ms

asset forge.all.js 662 bytes [emitted] (name: forge)

ERROR in forge
Module not found: Error: Recursion in resolving
Stack:
  undefined: (/home/ayoyimika/debian-js-packaging/forge/node-node-forge) ./lib/index.all.js

webpack 5.65.0 compiled with 1 error in 489 ms

assets by status 0 bytes [cached] 1 asset

ERROR in forge
Module not found: Error: Recursion in resolving
Stack:
  undefined: (/home/ayoyimika/debian-js-packaging/forge/node-node-forge) ./lib/index.all.js

webpack 5.65.0 compiled with 1 error in 758 ms

asset prime.worker.js 662 bytes [emitted] (name: forge)

ERROR in forge
Module not found: Error: Recursion in resolving
Stack:
  undefined: (/home/ayoyimika/debian-js-packaging/forge/node-node-forge) ./lib/forge.js

ERROR in forge
Module not found: Error: Recursion in resolving
Stack:
  undefined: (/home/ayoyimika/debian-js-packaging/forge/node-node-forge) ./lib/prime.worker.js

webpack 5.65.0 compiled with 2 errors in 440 ms

assets by status 0 bytes [cached] 1 asset

ERROR in forge
Module not found: Error: Recursion in resolving
Stack:
  undefined: (/home/ayoyimika/debian-js-packaging/forge/node-node-forge) ./lib/forge.js

ERROR in forge
Module not found: Error: Recursion in resolving
Stack:
  undefined: (/home/ayoyimika/debian-js-packaging/forge/node-node-forge) ./lib/prime.worker.js

webpack 5.65.0 compiled with 2 errors in 748 ms
make[1]: *** [debian/rules:27: debian/js/forge.min.js] Error 1
make[1]: Leaving directory '/home/ayoyimika/debian-js-packaging/forge/node-node-forge'
make: *** [debian/rules:43: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2

A simple solution i proffer is migrating to webpack5 to have access to its updated features, benefits and options https://webpack.js.org/migrate/5/

Thanks and Cheers

@davidlehn
Copy link
Member

The migration to webpack 5 hasn't happened yet due to trying to keep old Node.js releases working for a while longer. Updating tools will cause code to be untestable (or at least much more difficult to do so) with old nodes. At some point everything will be upgraded and old node support dropped in favor of all the fancy new tools and ES6+ features. Any change breaking old support will be in 2.x+. 0.10.x should be upgraded to 1.2.x+. That being said, I imagine webpack changes could be made to work with 0.10.x if needed.

I've upgraded other code from 4 to 5 and we've used similar patterns in most of the setups, so I figured forge wouldn't be too bad. Most of the polyfills are shut off too so not having them in 5 should be fine.

I can't tell from the error messages what's going on. Is there a need to upgrade forge itself? Is the issue that debian packages need to use webpack 5 now? Or just that some other app pulling in forge with webpack 5 wasn't working?

Where is a branch with these webpack 5 changes to try? I didn't find it on salsa.

FYI, I'm a debian developer too so could help with the debian side of things if needed.

@AyoyimikaAjibade
Copy link
Author

Thanks for your timely response and wanting to help. I truly appreciate it 🙏

i have updated node-forge to version 1.2.1 here is the salsa repo https://salsa.debian.org/Ayoyimika/node-node-forge
the package needed for local build of node-forge is webpack and node-webpack-source from the experimental distribution

Yes we are transitioning all reversed dependencies of webpack including node-forge to use webpack 5 now

Here is the branch which webpack5 is used https://salsa.debian.org/js-team/node-webpack/-/tree/master-5

@davidlehn
Copy link
Member

  • I did some webpack@5 work at Update to webpack@5 and webpack-cli@4. #945.
  • The web worker tests don't work due to some new webpack@5 style and/or karma issues I think. There are real use cases out there using web workers so this should be fixed to work. Help would be nice.
  • This isn't well tested so I'm unsure if it works beyond seeing the node and karma tests pass (other than web worker ones).
  • I'm unsure when this will get into the main branch. It does end the testing with older nodes and will be a major release. But maybe that's ok at this point in time.

@AyoyimikaAjibade
Copy link
Author

hello @davidlehn thanks a lot for the help

@dlongley
Copy link
Member

@davidlehn, can this be closed? I think we use webpack 5 on the main branch now.

@dlongley
Copy link
Member

Oh, no, just kidding, looks like we still haven't switched to webpack 5.

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

3 participants