-
-
Save gmh5225/ff06f1d5e0c186561e637883c439681c to your computer and use it in GitHub Desktop.
Making web3/bitcore-lib work with Angular 6-11 and >=11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {... | |
| "scripts": { | |
| "postinstall": "node patch.js", | |
| ... | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Angular >= 11 | |
| const fs = require('fs') | |
| const f = 'node_modules/@angular-devkit/build-angular/src/webpack/configs/browser.js' | |
| fs.readFile(f, 'utf8', function(err, data) { | |
| if (err) { | |
| return console.log(err) | |
| } | |
| var result = data.replace(/node: false/g, 'node: {crypto: true, stream: true, fs: "empty"}') | |
| fs.writeFile(f, result, 'utf8', function(err) { | |
| if (err) return console.log(err) | |
| }) | |
| }); | |
| // ---- | |
| // For Angular <11 | |
| const fs = require('fs'); | |
| const f = 'node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js'; | |
| fs.readFile(f, 'utf8', function (err,data) { | |
| if (err) { | |
| return console.log(err); | |
| } | |
| var result = data.replace(/node: false/g, 'node: {crypto: true, stream: true}'); | |
| fs.writeFile(f, result, 'utf8', function (err) { | |
| if (err) return console.log(err); | |
| }); | |
| }); | |
| // ---- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment