Added support for AMD/CommonJS/Globals.

Pull request related to #12783