Uncaught ReferenceError: require is not defined
See original GitHub issueHelp us help you! Please choose one:
- My app crashes with
react-rails
, so I’ve included the stack trace and the exact steps which make it crash. - My app doesn’t crash, but I’m getting unexpected behavior. So, I’ve described the unexpected behavior and suggested a new behavior.
- I’m trying to use
react-rails
with another library, but I’m having trouble. I’ve described my JavaScript management setup (eg, Sprockets, Webpack…), how I’m trying to use this other library, and why it’s not working. - I have another issue to discuss.
My project is currently set up with Rails 5, Webpacker and React-Rails and when I tried to render my react component I got the following error, “Uncaught ReferenceError: require is not defined”. I am assuming this is an issue with the Webpack configuration. Is there someone that help determine the cause of this error and how to fix it? – Thanks!
Link to repo: repo
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Client on Node.js: Uncaught ReferenceError: require is not ...
However, require is not defined on the client side, and it throws an error of the form Uncaught ReferenceError: require is not defined...
Read more >ReferenceError: require is not defined in JavaScript
To solve the "ReferenceError require is not defined" error, remove the type property if it's set to module in your package.json file and...
Read more >ReferenceError: require is not defined in JavaScript
The "ReferenceError: require is not defined" error occurs when the require function is used in a JavaScript file that is intended to be ......
Read more >How To Fix ReferenceError require is not defined in ...
In this case, check your package.json file for an property called type . If that is set to module , ES6 modules will...
Read more >Javascript - How to fix ReferenceError: require is not defined
This usually happens because your JavaScript environment doesn't understand how to handle the call to require() function you defined in your ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In my environment, I had fixed this error with replacing var to const. It looks like var hoisting causes this error.
Closing the issue.