1

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.

4

1 回答 1

1

如果其他文件需要 work.Utils 那么这些文件中应该需要它。

于 2013-11-21T09:50:59.853 回答