How do I report a custom Dojo assembly about external libraries?

In my Dojo build, I am picking up some third-party libraries.

When I look at the build process, I get errors due to ReferenceErrors.

This is normal. It makes sense.

However, I would like to talk about the build process of Dojo about what is referenced. Essentially, it would be like going through externs to the Complic Cliler.

So my question is: how do I tell the Dojo build process about links that it cannot get out of my code base?

Used by Dojo 1.8

+4
source share
1 answer

I just stumbled upon this myself. Now I assume that the referenced ReferenceErrors are related to browser objects such as navigator , window , document and the like. If this is the case, then this is a problem that occurs during the Dojo build process itself, because the build is done using dojo.js running inside Rhino, where global browser objects are not defined. This is a dojo / Rhino error, not a closure compiler error, so you cannot go to closure anything to change this. For example, a script like

 (function(){ window.alert("hello"); })(); 

splits your Dojo construct if included in the Dojo layer. When the AMD Dojo loader resolves the script dependency as described above, it will run the function body, resulting in a ReferenceError link, since there is no window in Rhino.

To get around this, wrap the script as an AMD module

 define([], function(){ window.alert("hello"); }); 

and then the function body will NOT be executed by the AMD loader during the build of Dojo.

+4
source

All Articles