Library and Package Import

Library and package import features can speed development.

JavaScript libraries can be shared across cartridges using the importScript("cartridgename:path/scriptname.ds") syntax (the cartridge name is optional if the script is located in the current cartridge). You can also share JavaScript pipelets, which can be stored in a dedicated cartridge so they can be used from other cartridges.

Note: To specify the script, use the file name of the actual script (name.ds), relative to the scripts folder containing the pipeline or the scripts folder of another cartridge. A simple path refers to the pipeline cartridge and a prefix such as 'cartridgename:' refers to a specific cartridge.
Feature Call Description
Import packages importPackages( dw.util ); Reuse processes that are outside the pipeline
Import class importClass( dw.util.HashMap ); Reuse classes that are outside the pipeline
Library mechanism importScript( "mylib:export/orderhandling.ds" ); Reuse scripts that are outside the pipeline