Next-generation platformDeprecated

Creating a module

You can create new flows or modules in accordance with your business requirements.

Procedure

Create a module.
  1. Create the following folder structure under SCREEN_EXTENSIONS_HOME, if not already present.SCREEN_EXTENSIONS_HOME/features
    Note:

    The application-provided feature modules are present in the <WORKSPACE>/store-frontend/src/app/features folder. It is a good practice to create new custom modules under the features folder in the SCREEN_EXTENSIONS_HOME location.

  2. Go to the SCREEN_EXTENSIONS_HOME/features folder and execute the following command to create a new module:ng g m <moduleName> --project=store-extensionsUse the --routing argument to add routing to your module.
    Note: It is mandatory to pass argument --project=store-extensions. Failing to do so will create the component in application-provided src folder (<WORKSPACE>/store-frontend/src). The files created here are ignored and not rendered on browser.
  3. In the store-customization-impl.ts file, define the route for lazy loading the module in the featureModuleExtensionRoutes property.
    For example, if you create a user module under SCREEN_EXTENSIONS_HOME/features, then the store-customization-impl.ts file will contain:
    
             static featureModuleExtensionRoutes: Routes = [
            {
                path: 'user',
                loadChildren: './../features/user/user.module#UserModule'
            }
        ];
    Notes:
    • The path for the loadChildren property must be provided relative to the <WORKSPACE>/store-frontend/src/app/app-shell location.
    • You can refer to route path definitions of feature modules in <WORKSPACE>/store-frontend/src/app/app-shell/app-shell-routing.module.ts
      Important: The contents of this file should NOT be modified and should be used for reference purposes only.
    • It is recommended to lazy load the modules to improve the application performance.
  4. Create a new folder under BUNDLE_EXTENSIONS_HOME for the custom module and also create the en.json file.

    For example, if you are writing a new custom module, say User, create the corresponding translations folder, say user within BUNDLE_EXTENSIONS_HOME and the en.jsonfile as follows:store-frontend/store-extensions-src/assets/store-frontend/i18n/user/en.json

    For more information, refer Defining bundle entry for new components of new module or flow.