The liferay-npm-bundler is a bundler (like Webpack or Browserify ) that targets Liferay Portal as a platform and assumes you’re using your npm packages from portlets (as opposed to typical web applications).

The workflow for running npm packages inside portlets is slightly different from standard bundlers. Instead of bundling the JavaScript in a single file, you must link all packages together in the browser when the full web page is assembled. This lets portlets share common versions of modules instead of each one loading its own copy. The liferay-npm-bundler handles this for you.

This section of reference docs covers how Portal supports npm-based portlet projects with the liferay-npm-bundler.

How the Liferay npm Bundler Works Internally

The liferay-npm-bundler takes a portlet project and outputs its files (including npm packages) to a build folder, so the standard portlet build (Gradle) can produce an OSGi bundle. You can learn...

Read More

Configuring liferay-npm-bundler

The liferay-npm-bundler is configured via a .npmbundlerrc file placed in the portlet project’s root folder. You can create a complete configuration manually or extend a configuration preset (via...

Read More

How the Default Preset Configures the liferay-npm-bundler

The liferay-npm-bundler comes with a default configuration preset: liferay-npm-bundler-preset-standard —Note you may omit the liferay-npm-bundler prefix from the npm package name in your...

Read More

The Structure of OSGi Bundles Containing npm Packages

To deploy JavaScript modules, you must create an OSGi bundle with the npm dependencies extracted from the project’s node_modules folder and modify them to work with the Liferay AMD Loader. The...

Read More

How the Liferay npm Bundler Publishes npm Packages

When you deploy an OSGi bundle with the specified structure, as explained in The Structure of OSGi Bundles Containing NPM Packages reference, its modules are made available for consumption through...

Read More

Understanding How liferay-npm-bundler Formats JavaScript Modules for AMD

Liferay AMD Loader is based on the AMD specification. All modules inside an npm OSGi bundle must be in AMD format. This is done for CommonJS modules by wrapping the module code inside a define...

Read More

Understanding How Liferay AMD Loader Configuration is Exported

NOTE: This article is for users who know how Liferay AMD Loader works under the hood. You can learn more about Liferay AMD Loader in the Liferay AMD Module Loader tutorial. With de-duplication in...

Read More

What Changed Between Liferay npm Bundler 1.x and 2.x

This reference doc outlines the key changes between liferay-npm-bundler version 1.x and 2.x. Automatically Formatting Modules for AMD In version series 1.x of the bundler it was the developer’s...

Read More
0 (0 Votes)
FreeMarker Taglib Macros Previous