can.import
Imports a module with the underlying module loader.
util.import(moduleName)
Imports a module with the underlying module loader.
Parameters
-
moduleName
{String}The module name to load. Example:
components/my-component.
Returns
{Promise}
A promise that resolves if the module was successfully loaded and is rejected if the module can not be successfully loaded.
Use
can.importis used internally by can.autorender when it finds <can-import> tags to import those modules before rendering the template.In the following example,
can.importwill import"components/my-component"prior to the template being rendered.Module Loaders
can.importlooks first for aSystemloader, followed byrequire.amd, followed bystealfollowed by a CommonJSrequire.