There's a polyfill being used in the webpack configuration that prevents the latest version of the fcl libary from being used in chrome extensions. This is to do with how cross-fetch works. It's calling XMLHttpRequest which is unavailable in Chrome service workers. I discovered this when upgrading the fcl libaries in the Flow Reference Wallet extension. It previously used 1.5.0-alpha.1 of the transport-http library. Upgrading that libary to 1.10.2 prevents the wallet from connecting to flow.
The issue is caused by the polyfill to http and https used in the webpack configuration in fcl-js/packages/fcl-bundle/src/webpack.config.js:
I managed to resolve the issue in the extension (temporarily) by including cross-fetch directly, forcing that version to be used by all libaries, then turning off the polyfills explicitly.
resolve: {
alias: {
// Forces all cross-fetch imports to use the same instance
'cross-fetch': require.resolve('cross-fetch'),
},
fallback: {
// Removes polyfills that were interfering with native fetch
http: false,
https: false,
}
}
Expected Behavior
I shouldn't have to modify webpack to use the latest version of the fcl libaries
Steps To Reproduce
Build and run the flow reference wallet with this sha 9dbbc58
You can see the (temporary) fix in the commit after this one: f65ac2f
Environment
- OS: macOS
- Node: 22
- npm: pnpm 9
What are you currently working on that this is blocking?
I'm working on the Flow Reference Wallet chrome extension
Current Behavior
There's a polyfill being used in the webpack configuration that prevents the latest version of the fcl libary from being used in chrome extensions. This is to do with how cross-fetch works. It's calling XMLHttpRequest which is unavailable in Chrome service workers. I discovered this when upgrading the fcl libaries in the Flow Reference Wallet extension. It previously used 1.5.0-alpha.1 of the transport-http library. Upgrading that libary to 1.10.2 prevents the wallet from connecting to flow.
The issue is caused by the polyfill to http and https used in the webpack configuration in fcl-js/packages/fcl-bundle/src/webpack.config.js:
I managed to resolve the issue in the extension (temporarily) by including cross-fetch directly, forcing that version to be used by all libaries, then turning off the polyfills explicitly.
Expected Behavior
I shouldn't have to modify webpack to use the latest version of the fcl libaries
Steps To Reproduce
Build and run the flow reference wallet with this sha 9dbbc58
You can see the (temporary) fix in the commit after this one: f65ac2f
Environment
What are you currently working on that this is blocking?
I'm working on the Flow Reference Wallet chrome extension