Frage

I have searched everywhere and it seems i can't find an answer for this question: What is the order in which the google closure compiler resolves the dependencies using the goog.require function.

Example:

goog.require('work.Utils');
goog.require('work.Languages');
goog.require('work.BrowserData');
goog.require('work.EventSystem');
goog.require('work.FileDescriptor');
goog.require('work.Environment');

These are all required in a single file in the exact order as they would use one another. For example work.BrowserData uses work.Languages, but all of the files use work.Utils. So instead of requiring in each file the work.Utils I included on top so the compiler would load it first and then load the rest.

The problem is that after compilation the inclusion order is different:

work.EventSystem
work.FileDescriptor
work.Environment
work.BrowserData
work.Languages
work.Utils

That means at execution point neither of the files have access to work.Utils and work.BrowserData has issues of finding work.Utils.

Besides including every required file in every file( which is a tedious work to do for a large library), what is ( if it exists ) the other solution.

Thank you.

War es hilfreich?

Lösung

if other files require work.Utils then it should be required in those files.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top