0

I have been trying to use snoop wrap with javascript to be able to call the reddit api, and I continously get an error here:

const snoowrap = require('snoowrap');

The error says:

Uncaught ReferenceError: require is not defined

I have found multiple different answers where they use browserify, but I have tried that too, to no avail. Can someone please give me a straight answer about what I have to do to solve this error?

Ephrem Adugna
  • 67
  • 1
  • 5

1 Answers1

1

I found the solution, it was just a problem on my part because I included my javascript files like so when using broser:

<script src="originalfile.js"></script>
<script src="bundle.js"></script>

When I should have done it like this:

<script src="bundle.js"></script>
shreyasm-dev
  • 2,711
  • 5
  • 16
  • 34
Ephrem Adugna
  • 67
  • 1
  • 5