How can I load my own js module with goog.provide and goog.require?

后端 未结 7 1087
小蘑菇
小蘑菇 2020-12-30 04:05

We are trying to switch the packaging for our project from dojo to google closure, but we haven\'t had any luck so far. Here is a simple example that illustrates what we are

7条回答
  •  既然无缘
    2020-12-30 04:35

    Update!!!

    New version of calcdeps.py changes the game a little bit. To create your deps.js you now need to use the -d flag. eg:

    python path-to-closure-library/closure/bin/calcdeps.py -i path-to-your-src/requirements.js -o deps -d path-to-closure-library/closure/ -p path-to-your-src/ --output_file=path-to-your-src/deps.js
    

    To compile:

    python path-to-closure-library/closure/bin/calcdeps.py -i path-to-your-src/requirements.js -d path-to-closure-library/closure/ -p ./ --output_file=path-to-your-release/scripts.min.js -c path-to-compiler/compiler.jar -f "--compilation_level=ADVANCED_OPTIMIZATIONS" -f "--debug=true" -f "--process_closure_primitives=true" -f "--manage_closure_dependencies=true" -o compiled
    

    So the process is actually now a lot easier, but you have to use your powers of ESP to find out about it as its totally undocumented. The calcdeps.py now also does not work with Python 3.1 on windows so that is also heaps of fun. A few hacks got it working for me (which I will not put here as I'm not a python programmer and there must be better ways to do it).

    Generally the last day has been super fun, hope this post helps someone avoid the same enjoyment.

    Guido

提交回复
热议问题