I’m using a bit of jQuery, to check if a custom plugin is installed and running. If it is, it should execute some code. If it isn’t, well, it shouldn’t execute the code.
The problem is: when compiling the code with Yarn, (or if Yarn is just watching the files with start
), it tells me the variable basm
is undefined.
If I copy paste the jQuery in Chrome’s console, it works perfectly fine, so the variable is defined. However, Yarn can’t see this, so it just returns the error.
Just defining basm
in the function doesn’t work, because than it would run on all pages. I’ve tried changing from init:
to running it on finalize:
, with no luck, because basm
never gets defined in my code.
Can I ignore errors in a file? Can I load the code “externally” without it getting compiled and tested? Right now I have included the code with routes in it’s own .js
.
In short: the code works, but the variable basm
isn’t defined within my code, but gets served up by the server. How to overrule the basm is not defined
error?