Create the extension structure for application-level JavaScript

To add application-level JavaScript files to an extension, create a global/ directory in the extension’s root folder. The following is an example:

<extension-name> : The root folder of your extension
     ext.json
     global/
         <application-level-module-1>.js
         <application-level-module-2>.js
         <application-level-module-n>.js

Place any application-level JavaScript files in this global/ directory. There is no limit to the number of files you can place in the global/ directory but the files themselves must follow these rules:

  • They must be anonymous, that is, have no package name defined in the module.
  • Structurally, they must be valid RequireJS modules.
  • Each filename must be unique. If a file with the same name has been loaded in another extension, an error is returned.