Creating a module
You can create new flows or modules in accordance with your business requirements.
Procedure
Create a module.
- Create the following folder structure under
SCREEN_EXTENSIONS_HOME, if not already
present.SCREEN_EXTENSIONS_HOME/featuresNote:
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.
- 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-providedsrcfolder (<WORKSPACE>/store-frontend/src). The files created here are ignored and not rendered on browser. - In the store-customization-impl.ts file, define the route for
lazy loading the module in the
featureModuleExtensionRoutesproperty.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
loadChildrenproperty 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.
- The path for the
- 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.jsonFor more information, refer Defining bundle entry for new components of new module or flow.