Registry / devops / liferay-npm-bundler

liferay-npm-bundler

JSON →
library2.32.2jsnpmunverified

liferay-npm-bundler is a specialized Command Line Interface (CLI) utility designed to process Liferay widget projects and produce OSGi bundles, encapsulating the necessary npm dependencies for deployment to the Liferay Portal. Functioning similarly to bundlers like Webpack, it uniquely targets Liferay Portal as its platform, handling the intricacies of OSGi module packaging for frontend assets. This includes linking packages in the browser and facilitating the sharing of common module versions across widgets rather than each loading its own copy. It converts application resources and npm dependencies into a Liferay OSGi bundle, preparing them for deployment via a standard widget build (e.g., Gradle). As of its latest version, 2.32.2, it was part of the actively developed `liferay-frontend-projects` monorepo. However, it has been officially deprecated as of Liferay 2024.Q4/Portal GA129 and is scheduled for future removal, with Liferay shifting towards alternative frontend development and optimization strategies.

npm install liferay-npm-bundler
INSTALL
IMPORT
SIG · LIFERAY-NPM-BUNDLE
L
liferay-npm-bundler
devopsjavascriptv2.32.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

main
import main from 'liferay-npm-bundler';
const main = require('liferay-npm-bundler');
The primary CLI function can be imported as the package's default export for programmatic execution.
bundle
import { bundle } from 'liferay-npm-bundler/lib/bundler';
const { bundle } = require('liferay-npm-bundler/bundler');
The core bundling logic is exposed via the `bundle` function from an internal module, useful for custom build processes.
getMergedConfig
import { getMergedConfig } from 'liferay-npm-bundler/lib/config';
const { getMergedConfig } = require('liferay-npm-bundler/config');
For advanced scenarios, configuration merging logic can be accessed directly from its internal module.

Demonstrates `liferay-npm-bundler` integration into `package.json` scripts for a typical Liferay widget project.

{ "name": "my-liferay-widget", "version": "1.0.0", "description": "A sample Liferay widget", "main": "src/index.js", "scripts": { "build": "liferay-npm-bundler" }, "dependencies": { "react": "^18.0.0", "react-dom": "^18.0.0" }, "devDependencies": { "liferay-npm-bundler": "^2.32.2" } } // To run the bundler: // npm install // npm run build // This will process your project and dependencies into an OSGi bundle compatible with Liferay Portal.
liferay-npm-bundler --version
Debug
Known issues
deprecated`liferay-npm-bundler` has been officially deprecated as of Liferay 2024.Q4/Portal GA129 and is slated for removal in future releases. Users should migrate to alternative Liferay frontend development strategies.
fix
Consult Liferay's official documentation for current best practices and recommended alternatives for frontend development and deployment.
affects: >=2.32.2
breakingVersion 2.32.0 (and potentially earlier minor versions) had a breaking change related to an updated `globby` dependency, leading to 'ENOENT' errors during builds in some environments.
fix
Upgrade `liferay-npm-bundler` to version 2.32.1 or later, which includes a fix for the `globby` compatibility issue.
affects: 2.32.0
gotchaNode.js and npm version compatibility is crucial. Liferay frontend tools, including this bundler, are designed for specific Node.js and npm versions. Using unsupported versions can lead to build failures.
fix
Always check the official Liferay Node.js compatibility matrix for your Liferay DXP version and ensure your development environment adheres to those specifications.
affects: >=1.0.0
gotcha`liferay-npm-bundler` is tightly coupled with Liferay Portal versions. Using an incompatible version of the bundler with your target Liferay Portal instance can result in deployment failures or unexpected runtime behavior.
fix
Refer to Liferay's documentation for the compatibility matrix between `liferay-npm-bundler` and Liferay DXP versions to ensure proper alignment.
affects: >=1.0.0
gotchaUnlike generic bundlers such as Webpack, `liferay-npm-bundler` targets an AMD loader. Its loader mechanisms are not compatible with Webpack loaders, which can be a source of confusion for developers familiar with other bundling tools.
fix
Avoid attempting to use Webpack-specific loader configurations or plugins directly with `liferay-npm-bundler`. Understand its unique approach to module loading and rule processing for Liferay's AMD environment.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Command failed with exit code 1: liferay-npm-bundler
A generic error indicating that the `liferay-npm-bundler` CLI process failed, often due to configuration issues, incompatible dependencies, or environment problems.
fix
Check the detailed output above the error for specific messages. Verify `package.json` scripts, `.npmbundlerrc` configuration, Node.js/npm versions, and Liferay Portal compatibility.
Module not found: Can't resolve 'some-dependency' in 'some-path'
The bundler could not locate a required npm package within your project's dependency tree or node_modules.
fix
Ensure the dependency is correctly listed in `package.json`, installed via `npm install`, and that any custom module resolution paths in `.npmbundlerrc` are accurate.
Error: Liferay Portal version X is not supported by this bundler version.
The installed `liferay-npm-bundler` version is incompatible with the target Liferay Portal version for which the OSGi bundle is being prepared.
fix
Update or downgrade `liferay-npm-bundler` to a version officially supported by your Liferay Portal version, as specified in Liferay's compatibility documentation.
ENOENT: no such file or directory, scandir 'path/to/missing/file'
This specific error can occur due to an incompatibility with the `globby` dependency, particularly in versions prior to 2.32.1.
fix
Upgrade `liferay-npm-bundler` to version 2.32.1 or higher to resolve the `globby` compatibility issue.
Invalid configuration option: 'someOption'
A configuration option in your `.npmbundlerrc` file or `package.json` `liferay-npm-bundler` section is not recognized or is malformed.
fix
Review your `liferay-npm-bundler` configuration files against the official documentation to ensure all options and their syntax are correct and supported by your bundler version.
Upgrade
Version history
2.32.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
liferay-npm-bundler — npm install liferay-npm-bundler · libregistry