javascriptgoogle-closuregoogle-closure-library

How to use goog.module to load modules dynamically


I want to use goog.module of google closure library to implement JS module lazy loading.

I've been able to use the modules by typing goog.require(module_name). However, the script module will be loaded at the beginning in this way. So I'd like to have the modules loaded dynamically (lazy load) by using goog.module. But I found the documentation for goog.module very hard to understand.

Any suggestions?


Solution

  • The only "documentation" I've been able to find for modules, is a mention of the support of modules in Plovr: http://plovr.com/

    So the source code of the Plovr library (https://code.google.com/p/plovr/) is the only "documentation" I'm aware of.