Skip to content

Commit 62ba6c3

Browse files
committed
Remove crypto polyfill
The FtM TS library relies on the Node.js `crypto` module (which isn’t available in browsers) in order to implement [namespace signatures](https://github.com/alephdata/followthemoney/blob/main/js/src/namespace.ts). The `crypto-browserify` polyfill is quite big and there were a few questions around continued maintenance of that project, so it would be good to remove it as an dependency. I initially planned to update the namespacing implementation in the TS lib with the Web Crypto API which is available Node.js and browsers, but this would require breaking changes to the TS API as the Web Crypto API is async. However, as far as I can see we do not actually rely on the TS implementation of namespaces in the UI, so we should be able to drop the polyfill without any further changes to the TS lib.
1 parent 1ef1040 commit 62ba6c3

File tree

3 files changed

+20
-363
lines changed

3 files changed

+20
-363
lines changed

ui/craco.config.js

+15
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,21 @@ const svgIcon = (path, selectors) => {
6464
};
6565

6666
module.exports = {
67+
webpack: {
68+
configure: (config) => ({
69+
...config,
70+
resolve: {
71+
...config.resolve,
72+
fallback: {
73+
// The Node.js crypto module isn’t available in browser contexts. However,
74+
// code paths that require it aren’t actually called in the Aleph UI, so we
75+
// resolve to an empty module.
76+
// https://webpack.js.org/configuration/resolve/#resolvefallback
77+
'crypto': false,
78+
},
79+
},
80+
}),
81+
},
6782
style: {
6883
sass: {
6984
implementation: sass,

0 commit comments

Comments
 (0)