All issues which aren't created with this template will get immediately closed.
To be a web3.min.js
There are web3.cjs.js, web3.esm.js and web3.umd.js, but no web3.min.js, which is what I was used to work with
We will no longer provide a minified full bundle in the NPM package. It's required to bundle your javascript code with Webpack. This because of performance and security reasons.
A Webpack starter project for the Web3.js lib can be found here.
I have the same problem. I tried the suggested repository. I was able to generate dist/main.js (which includes a lot of evals?).
But in the end it tries to include web3.js with require what isn't working in the browser (src/index.js). How can I include web3.js into my browser?
This is super annoying when I have a dapp that has to be served locally. Injecting web3 with metamask gives an old version, 0.20.3, and it's a pain to not have a static js version I can use on client side to use newer versions of web3.
If you are having a similar problem this cdn might be helpful https://cdn.jsdelivr.net/gh/ethereum/[email protected]/dist/web3.min.js
However, like nivida mentioned, there are some security reasons behind not using this. For me its good though
Hey, yes I'm using beta.37 (https://cdn.jsdelivr.net/gh/ethereum/[email protected]/dist/web3.min.js) at the moment, but it's already outdated and doesn't support all functions anymore.
In my environment I can't have nodejs I can work with JS only. Is there a way to compile the newest version by yourself to use it than?
What kind of security issues?
C'mon, if they are not providing it, at least UPDATE THE DOCS!
@igormuba The docs are also open source, feel free to update and make a PR yourself.
@igormuba The docs are also open source, feel free to update and make a PR yourself.
I have been working for days already trying to figure out how is the 1.0 version supposed to work without web3.min.js, once I figure out how to build a front end without it for myself, I will be more than happy to update and make tutorials, but so far, I am struggling to even understand how do they want us to work without that script...
The point is you're supposed to serve web3 via a server of some kind.
web3 = require(web3)
For me, even with webpack, web3 will be overwritten to 0.x version by metamask unless doing a html link to cdn. They are buggy though. Someone got a better solution?
Maybe web3.version.api reports the wrong version because everything seems to work the same.
Can you share a link how to compile web3.js for the browser using webpack? I tried it with browserify but it wasn't working. Still stuck with beta.37:\
Um...are we ever going to have a version of web3 that runs straight in the browser, like we used to? This is causing me a lot of issues...dealing with the es modules version that doesn't work directly in the browser, the umd version that doesn't work, the cdn that is outdated...not everyone uses webpack or parcel or a bundler, we would like to run web3 directly in the browser without a complicated bundler or build process.
This is super annoying when I have a dapp that has to be served locally. Injecting web3 with metamask gives an old version, 0.20.3, and it's a pain to not have a static js version I can use on client side to use newer versions of web3.
If you are having a similar problem this cdn might be helpful https://cdn.jsdelivr.net/gh/ethereum/[email protected]/dist/web3.min.js
However, like nivida mentioned, there are some security reasons behind not using this. For me its good though
Any lead on how can i solve this issue? I am tired with it already. web3.version.api gives 0.20.7 and this version does not support some of the most important functions.
@saadibrahimiv you should be able to use the provider to provision your own Web3 instance. I'd recommend going with the latest in the 1.x branch. You can learn more here: https://docs.metamask.io/guide/ethereum-provider.html
@saadibrahimiv you should be able to use the provider to provision your own Web3 instance. I'd recommend going with the latest in the 1.x branch. You can learn more here: https://docs.metamask.io/guide/ethereum-provider.html
I resolved the issues using cdn in my html.
Most helpful comment
This is super annoying when I have a dapp that has to be served locally. Injecting web3 with metamask gives an old version, 0.20.3, and it's a pain to not have a static js version I can use on client side to use newer versions of web3.
If you are having a similar problem this cdn might be helpful https://cdn.jsdelivr.net/gh/ethereum/[email protected]/dist/web3.min.js
However, like nivida mentioned, there are some security reasons behind not using this. For me its good though