Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading web3.min.js in browser fails with "require is not defined" #3256

Closed
digulla opened this issue Dec 5, 2019 · 5 comments · Fixed by #3261
Closed

Loading web3.min.js in browser fails with "require is not defined" #3256

digulla opened this issue Dec 5, 2019 · 5 comments · Fixed by #3261
Assignees
Labels
1.x 1.0 related issues Bug Addressing a bug

Comments

@digulla
Copy link

digulla commented Dec 5, 2019

I've installed web3@1.2.4 with npm install.
I copied the file node_modules/web3/dist/web3.min.js into my web app.
I'm loading the file with:

<script type="text/javascript" src="js/web3.min.js"></script>

In the browser console (Chrome 70+), I see this error:

Uncaught ReferenceError: require is not defined
    at web3.js:1
@nivida
Copy link
Contributor

nivida commented Dec 5, 2019

Thanks for opening this issue! The minified file here provided in the GitHub repository does work as expected but the published one in the web3 package not. We will publish a new fixed minified file on the next patch release. I apologize for all the trouble you might have.

@nivida nivida added 1.x 1.0 related issues Bug Addressing a bug CI labels Dec 5, 2019
@cgewecke cgewecke mentioned this issue Dec 7, 2019
12 tasks
@wktian1987
Copy link

v1.2.2 is ok without this error.

@digulla
Copy link
Author

digulla commented Dec 10, 2019

@nivida Where is the minified file? The one in the ZIP archive https://github.com/ethereum/web3.js/releases/tag/v1.2.4 has the same problem.

v1.2.2 works for me.

@nivida
Copy link
Contributor

nivida commented Dec 10, 2019

@digulla Thanks for asking this! The minified file can be found here.

@digulla
Copy link
Author

digulla commented Dec 10, 2019

@nivida Still getting the same error with the file at your link.
sha256 of the file:

42037f35ccf2195cdd80448f4963515dd8c6a2d7b416f042743c1d4cec7fc17d  web3.min.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Bug Addressing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants