How AMD Loader Configuration is Exported
The Liferay npm bundler is deprecated of Liferay 2024.Q4/7.4 GA129, and it’s planned for future removal.
If you don’t understand how Liferay AMD Loader works under the hood, please read Liferay AMD Module Loader first.
With de-duplication in place, JavaScript modules are made available to Liferay AMD Loader through the configuration returned by the /o/js_loader_modules
URL.
The OSGi bundle shown below is used for reference in this article:
my-bundle/
META-INF/
resources/
package.json
- name: my-bundle-package
- version: 1.0.0
- main: lib/index
- dependencies:
- isarray: 2.0.0
- isobject: 2.1.0
- …
lib/
index.js
- …
- …
node_modules/
isobject@2.1.0/
package.json
- name: isobject
- version: 2.1.0
- main: lib/index
- dependencies:
- isarray: 1.0.0
- …
- …
isarray@1.0.0/
package.json
- name: isarray
- version: 1.0.0
- …
- …
isarray@2.0.0/
package.json
- name: isarray
- version: 2.0.0
- …
- …
For example, for the above structure, as explained in OSGi Bundles and npm Package Structure, the configuration below is published for Liferay AMD loader to consume:
Note:
- The
Liferay.PATHS
property describes paths to the JavaScript module files. - The
Liferay.MODULES
property describes the dependency names and versions of each module. - The
Liferay.MAPS
property describes the aliases of the package’s main modules.