Closed as not planned
Closed as not planned
Description
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
Yes
Description
We create a crypto project using some of the well known packages you need to run web3
libraries on a browser. Everything is fine using the old builder, but upgrading to the new esbuild
builder is not working, the build runs into issues.
This libraries are available out of the box in node but in a browser environment you need to add them and configure in tsconfig
paths
As you can see in the provided exception it is not working, the 3rd party libs are not resolving the names in the paths
"paths": {
"crypto": [
"node_modules/crypto-browserify"
],
"stream": [
"node_modules/stream-browserify"
],
"os": [
"node_modules/os-browserify"
],
"https": [
"node_modules/https-browserify"
],
"http": [
"node_modules/stream-http"
],
"url": [
"node_modules/url"
]
},
But those seems to not work, you can see in the
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Could not resolve "crypto"
node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js:5:201:
5 │ ...!== "undefined") rnd = require("c" + "rypto").randomBytes(bytes)...
╵ ~~~
The package "crypto" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
Please provide the environment you discovered this bug in (run ng version
)
Angular CLI: 17.1.0
Node: 18.16.0
Package Manager: npm 9.8.1
OS: darwin x64
Angular: 17.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1701.0
@angular-devkit/build-angular 17.1.0
@angular-devkit/core 17.1.0
@angular-devkit/schematics 17.1.0
@schematics/angular 17.1.0
rxjs 7.8.0
typescript 5.3.3
zone.js 0.14.2
Anything else?
EDIT: I've created an example project to easy reproduce this, have a look at the first comment here in the issue