Skip to content

Commit

Permalink
chore: fix polyfill issues (#979)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aman035 authored Jan 5, 2024
1 parent d738ead commit d6c8f34
Show file tree
Hide file tree
Showing 4 changed files with 582 additions and 16 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"buffer": "^6.0.3",
"chai": "^4.3.7",
"core-js": "^3.6.5",
"crypto-browserify": "^3.12.0",
"date-fns": "^2.28.0",
"ethers": "^5.7.1",
"expo": "^45.0.0",
Expand Down Expand Up @@ -55,6 +56,11 @@
"viem": "^1.3.0"
},
"devDependencies": {
"browserify-zlib": "^0.2.0",
"https-browserify": "^1.0.0",
"node-polyfill-webpack-plugin": "^3.0.0",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-angular": "^17.0.0",
"@jscutlery/semver": "^2.27.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/sdk-frontend-react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
],
"styles": [],
"scripts": [],
"webpackConfig": "@nrwl/react/plugins/webpack"
"webpackConfig": "packages/examples/sdk-frontend-react/src/webpack.config.js"
},
"configurations": {
"development": {
Expand Down
24 changes: 24 additions & 0 deletions packages/examples/sdk-frontend-react/src/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const nrwlConfig = require('@nrwl/react/plugins/webpack.js');
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');

module.exports = (config, context) => {
nrwlConfig(config); // Apply @nrwl/react webpack configurations

// Add the NodePolyfillPlugin to the plugins array
config.plugins = [...config.plugins, new NodePolyfillPlugin()];

// Configure resolve fallbacks
config.resolve = {
...config.resolve,
fallback: {
...(config.resolve.fallback || {}),
http: require.resolve('stream-http'),
zlib: require.resolve('browserify-zlib'),
https: require.resolve('https-browserify'),
stream: require.resolve('stream-browserify'),
crypto: require.resolve('crypto-browserify'),
},
};

return config;
};
Loading

0 comments on commit d6c8f34

Please sign in to comment.