I'm working on a website that helps poets write poems. So, I decided to use Browserify to pull in libraries (rhyme-plus-plus and dom-ready only right now, and the errors have nothing to do with the library). I've been struggling to use Browserify, so I decided to isolate the Browserify part of the project, to no avail. I prefer to have listeners on the HTML as this allows for one javascript file to handle the entire website with ease, but the test was just a haiku so I tried both ways.
So I've tried both with and without dom-ready with this bit of code (the only problem child at this point)
inputs.forEach(function(input){
input.addEventListener(onchange, UpdateEndwords());
});
No matter what I'll get this error (sorry for pasting the whole thing, I just don't want to risk missing any information):
> bundle.js:9291 Uncaught TypeError: fs.createReadStream is not a function
> at module.exports (bundle.js:9291:16)
> at bundle.js:8478:13
> at NodeList.forEach (\<anonymous\>)
> at UpdateEndwords (bundle.js:8468:15)
> at bundle.js:8534:42
> at Array.forEach (\<anonymous\>)
> at 48.domready (bundle.js:8533:12)
> at o (bundle.js:1:265)
> at r (bundle.js:1:431)
> at bundle.js:1:460
And If I do this:
<input placeholder="7 syllables here" ... onchange="UpdateEndwords()"> </input>
Then upon triggering the event I get this:
> Uncaught ReferenceError: UpdateEndwords is not defined
> at HTMLInputElement.onchange (test.html:43:57)
>
dom-ready hasn't helped in either case (I saw it worked for a similar case). And I checked out the example Browserify gives and that worked like a charm. It has been a week of nonstop debugging. I hope I'm so stupid and the answer has just been right in front of me this entire time so that this suffering can end.
What was tried:
- using dom-ready
- Tried without dom-ready
- Tried using Array.ForEach to add event listeners
- Tried writing event listeners in HTML