Skip to main content

 

Hello Everyone, 

 

I’m currently working on validating both shipping and billing addresses using api for Site-Genesis architecture. 

 

Cartridge Path: custom_SiteGenesis_cartridge:sitegenesis_storefront_controllers:sitegenesis_storefront_core

 

 

In one of our controllers (COShipping.js), we are importing SiteGenesis core modules (standard): 

var app = require('~/cartridge/scripts/app'); 

var guard = require('~/cartridge/scripts/guard'); 

 

::::

It happens with other controllers also. 

 

When this controller executes, we get the following runtime error: 

ScriptingException Error: 

Module "custom_SiteGenesis_cartridge/cartridge/scripts/app" not found.

(custom_SiteGenesis_cartridge/cartridge/controllers/COShipping.js#20)

 

 

Currently, we copied app.js from the base cartridge into our custom cartridge. It is working fine but I have made no changes to app.js file. 

 

What is the Salesforce recommended best practice for building custom cartridges on SiteGenesis to avoid dependency and module resolution issues? 

 

Any ideas or best practices would be greatly appreciated!

2 respuestas
  1. 19 ene, 05:20

    hy @Vikash Kumar “This happens because require('~/cartridge/scripts/app') only looks inside the current cartridge. Copying app.js works but is not recommended. Salesforce best practice is to place custom controllers in a cartridge that extends the SiteGenesis controller cartridge, so all core scripts like app.js and guard.js are available without copying them.”

0/9000