Customize Bundle Modules

You can define the content of the requirejs module bundles to create multiple bundles when deploying a visual application.

Pages that you want to load initially can be packaged in the main bundle, and other pages and pages in other flows that are not required initially can be packaged in a separate bundle that can be loaded when needed. Customizing the module bundles can help optimize the time needed to load and run the application.

For example, this configuration example shows how the vb-require-bundle task can be configured to create the following require module bundles for a web application named “webapp1”.

To customize the bundle modules:

  1. Open Gruntfile.js.

  2. Edit the file to configure the vb-require-bundle task.

    {
      "vb-require-bundle": {
         "webapp1": {
             "options": {
                 "transpile": true,
                 "minify": true,
                 "bundles": {
                     "dashboard": {
                         "modules": {
                             "find": ["flows/dashboard"]
                         },
                         "exclude": {
                           "ids": ["helpers"]
                         }
                       },
                       "customers": {
                           "modules": {
                              "find": ["flows/customers", "!flows/customers/flows"]
                            },
                           "exclude": {
                             "ids": ["helpers"]
                             }
                       },
                       "customers-nested": {
                           "modules": {
                              "find": ["flows/customers/flows"]
                            }
                       },
                       "base": {
                         "modules": {
                           "find": [
                             "app-flow.js",
                             "^pages/",
                             "resources/strings",
                             "resources/css"
                           ],
                           "ids": ["helpers"]
                           }
                       }
                 }
             }
         }
      }
    }