Is there an existing issue for this?
Current Behavior
After following the instructions mentioned for Angular versions >= 11 I still can't ng-serve ng-build
Expected Behavior
to be able to ng-serve
Steps to Reproduce
After installing web3js off npm, I've also installed the other packages:
npm install --save-dev crypto-browserify stream-browserify assert stream-http https-browserify os-browserify
Added within tsconfig.json the following:
{
"compilerOptions": {
"paths" : {
"crypto": ["./node_modules/crypto-browserify"],
"stream": ["./node_modules/stream-browserify"],
"assert": ["./node_modules/assert"],
"http": ["./node_modules/stream-http"],
"https": ["./node_modules/https-browserify"],
"os": ["./node_modules/os-browserify"],
}
}
And finally in the polyfills.ts the following:
import { Buffer } from 'buffer';
(window as any).global = window;
global.Buffer = Buffer;
global.process = {
env: { DEBUG: undefined },
version: '',
nextTick: require('next-tick')
} as any;
As far as I can see it fails in the polyfills.ts with:
Error: src/polyfills.ts:56:2 - error TS2304: Cannot find name 'global'.
56 global.Buffer = Buffer;
Error: src/polyfills.ts:57:2 - error TS2304: Cannot find name 'global'.
57 global.process = {
Error: src/polyfills.ts:60:16 - error TS2591: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.
60 nextTick: require('next-tick')
Web3.js Version
1.7.0
Environment
- Operating System: Windows 11
- Browser: Edge Chromium / Brave
- Node.js Version: 17.5.0
- NPM Version: 8.5.0
Anything Else?
Added a zip file of my repo sample:
https://1drv.ms/u/s!Av4UoFRH90CIhZAQ4ISteiR6hbRdNQ?e=i4oAOQ
Is there an existing issue for this?
Current Behavior
After following the instructions mentioned for Angular versions >= 11 I still can't ng-serve ng-build
Expected Behavior
to be able to ng-serve
Steps to Reproduce
After installing web3js off npm, I've also installed the other packages:
npm install --save-dev crypto-browserify stream-browserify assert stream-http https-browserify os-browserifyAdded within tsconfig.json the following:
And finally in the polyfills.ts the following:
import { Buffer } from 'buffer';
As far as I can see it fails in the polyfills.ts with:
Error: src/polyfills.ts:56:2 - error TS2304: Cannot find name 'global'.
Web3.js Version
1.7.0
Environment
Anything Else?
Added a zip file of my repo sample:
https://1drv.ms/u/s!Av4UoFRH90CIhZAQ4ISteiR6hbRdNQ?e=i4oAOQ