webpackrequirejscryptojslaravel-9firefox-developer-tools

nodecrypto = require('crypto'); ReferenceError require is not defined


EDIT:

The correct question is: How do I get crypto out of the browser?

I am getting the error message: ReferenceError require is not defined

in my firefox debugging window

EDIT: it happens only in firefox and not in chrome or safari

nodecrypto = require('crypto');

What is really grinding my gears is that the application runs flawlessly and the error only occurs, when I am opening my dev tools with CMD+OPT+C (on mac) and then clikcing any link in my application.

When I click the same links regularly in the browser without my dev tools open no error occures.

error message

EDIT: This is how my java script is imported:


Solution

  • I had to reinstall firefox and the error was gone it was not related to my code but to the browser which had a mal function hope this helps someone PS: I recommend firefox nightly instead of firefox developer