Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Arweave-JS doesn't currently work with Webpack 5 in the browser

See original GitHub issue

Currently, importing Arweave-JS in a browser based project that uses Webpack 5 will result in a build-time error of the below sort: ERROR in ./node_modules/arweave/web/lib/merkle.js 9:15-30 Module not found: Error: Can’t resolve ‘util’ in ‘/home/jim/development/monkeys1/node_modules/arweave/web/lib’

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

This can be worked around at present by adding the below to webpack.configs.js:

module.exports = {
  plugins: [
    //Polyfill needed nodejs plugins for Arweave-js
    new webpack.ProvidePlugin({
      process: 'process/browser',
    }), new webpack.ProvidePlugin({
      util: 'util/',

and then npm i --save-dev util process to add these two node-js polyfill libraries to a given project.

Ideally, these dependencies would be resolved by browser-compatible imports within arweave/web//lib/merkle

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

hzhucommented, Jan 16, 2022

Hi @fewwwww. Yes it should be working. Here’s a demo:

fewwwwwcommented, Jan 16, 2022

This seems to still be an issue on 1.10.18 with a vanilla create-react-app on Webpack 5.

Hi hzhu, how did you solve it? I just cannot make it working with vanilla cra……

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack 5 Issues | Documentation - Web3Auth
This issue is caused due to the fact that the web3.js and ethers.js packages have certain dependencies, which are not present within the...
Read more >
i tried to Polyfill modules in webpack 5 but not working (Reactjs)
To use polyfill in webpack 5 in reactjs Follow the below steps: First Install npm install node-polyfill-webpack-plugin module.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found