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

Fails with node 18 #49

Closed
mattlewis92 opened this issue Aug 16, 2022 · 3 comments · Fixed by #50
Closed

Fails with node 18 #49

mattlewis92 opened this issue Aug 16, 2022 · 3 comments · Fixed by #50

Comments

@mattlewis92
Copy link
Contributor

Hey there!

When upgrading our application to node 18 it started throwing this error:

/node_modules/.pnpm/moment-timezone@0.5.32/node_modules/moment-timezone/index.js:2:15-51 - Error: Module not found: Error: error:0308010C:digit
al envelope routines::unsupported

After some digging I believe the problem is in this plugin as it uses md4:

https://github.com/gilmoreorless/moment-timezone-data-webpack-plugin/blob/main/src/helpers.js#L149

Just trying to run this in node 18 throws the error:

console.log(require('crypto').createHash("md4"));

Happy to send a PR with the fix!

2 options I can see:

  1. change the md4 => md5, downsides to this is it will invalidate the cache when updating as the hash will change
  2. conditionally change the hashing algorithm depending on the node version. More code but won't invalidate the cache on update

Let me know what you'd prefer!

mattlewis92 added a commit to mattlewis92/moment-timezone-data-webpack-plugin that referenced this issue Aug 16, 2022
@gilmoreorless
Copy link
Owner

Thanks for the PR. To answer your question about using md4, I only did that to be consistent with what webpack was using at the time. It looks like they also got hit by this error: webpack/webpack#14532

I'm happy to change the algorithm. The cache can often get invalidated with node_modules changes anyway, so I don't see this as a breaking change.

@gilmoreorless
Copy link
Owner

Your fix has been released in v1.5.1. 😄

@mattlewis92
Copy link
Contributor Author

Thank you!! 🙌

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

Successfully merging a pull request may close this issue.

2 participants