fabric icon indicating copy to clipboard operation
fabric copied to clipboard

Debug polyfill buffer error

Open victorwu opened this issue 2 years ago • 5 comments

Error stems from fabric.http.js minified file. WASM_BUFFER is used in secp256k1 which is a wasm compiled dependency. Line producing the error const WASM_BUFFER = new Uint8Array(wasm.memory.buffer);

victorwu avatar Oct 25 '22 23:10 victorwu

https://github.com/web3/web3.js#troubleshooting-and-known-issues

victorwu avatar Oct 25 '22 23:10 victorwu

https://stackoverflow.com/questions/64557638/how-to-polyfill-node-core-modules-in-webpack-5

victorwu avatar Oct 25 '22 23:10 victorwu

Integrating wasm to webpack did not make any progress, showed same errors

  • https://www.npmjs.com/package/@rollup/plugin-wasm
  • recommended to have relative paths, using ./ instead of _dirname
  • add alias to file https://stackoverflow.com/a/71956791
  • updating rollup config to use buffer https://github.com/SheetJS/sheetjs/issues/2367
  • installing buffer https://github.com/feross/safe-buffer/issues/30

victorwu avatar Oct 25 '22 23:10 victorwu

ordering of dependencies could cause issues, list parent dependencies below child dependencies

victorwu avatar Nov 08 '22 02:11 victorwu

https://viglucci.io/how-to-polyfill-buffer-with-webpack-5

victorwu avatar Nov 09 '22 03:11 victorwu