Library is not defined

The problem

App loads JS library, but still compiler says that:

jQuery is not defined.  

Most people will experience this with jQuery, but I had similar problems with few other libs as well.

The solution

This is caused because library will probably contain something similar to this:

if ( typeof module === "object" && typeof module.exports === "object" ) {
    module.exports = ...
} else ...

This will create problems since library will use module exports to create

Read More