Registry / web-framework / liferay-npm-bundler-improved

liferay-npm-bundler-improved

JSON →
library1.5.1jsnpmunverified

liferay-npm-bundler-improved is an unofficial, high-speed alternative to the official liferay-npm-bundler, designed to accelerate the development of Liferay portlets. Currently stable at version 1.5.1, its release cadence is feature-driven, with significant updates recently including beta phases for watch mode and localization. Key differentiators include drastically faster build times (around 0.1s on modern hardware) compared to the official bundler, an enhanced developer experience through a 'watch mode' with live instance replacement (primarily for Vite projects), comprehensive error reporting for common issues like missing `package.json` keys, and experimental localization support for `Liferay.Language.get()` functions within portlets. It also offers optional deployment automation and support for portlet instance configuration.

npm install liferay-npm-bundler-improved
INSTALL
IMPORT
SIG · LIFERAY-NPM-BUNDLE
L
liferay-npm-bundler-improved
web-frameworkjavascriptv1.5.1
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.

liferay-npm-bundler-improved
npx liferay-npm-bundler-improved [options]
import * as bundler from 'liferay-npm-bundler-improved'
This package is a Command Line Interface (CLI) tool. Its functionality is accessed by executing the 'liferay-npm-bundler-improved' command, typically via `npx` or as a script in `package.json`. It does not expose a JavaScript API for direct programmatic import.
WatchMode
liferay-npm-bundler-improved --watch
import { enableWatchMode } from 'liferay-npm-bundler-improved'
The watch mode feature is enabled through the `--watch` or `-w` CLI flag. There is no programmatic equivalent to activate or configure watch mode. Note that it requires Vite.
Deployment
liferay-npm-bundler-improved --deploy
import { deployPortlet } from 'liferay-npm-bundler-improved'
Deployment is triggered using the `--deploy` or `-d` CLI flag. This feature requires the `LIFERAY_DEPLOYMENT_PATH` environment variable to be set. No programmatic deployment function is exposed.

Demonstrates `liferay-npm-bundler-improved` setup in `package.json` scripts, including development with watch/deploy mode and a production build incorporating source and asset copying. Requires Vite for watch mode.

{ "name": "my-liferay-portlet", "version": "1.0.0", "description": "A sample Liferay portlet using liferay-npm-bundler-improved.", "main": "src/index.js", "scripts": { "dev": "liferay-npm-bundler-improved -w --deploy", "build": "liferay-npm-bundler-improved --copy-sources --copy-assets" }, "keywords": ["liferay", "portlet"], "devDependencies": { "liferay-npm-bundler-improved": "^1.5.1", "vite": "^5.0.0" // Required for watch mode }, "license": "MIT" } // To install dependencies: // pnpm i --D liferay-npm-bundler-improved vite // To use in development with watch mode and deployment (requires .env with LIFERAY_DEPLOYMENT_PATH): // Set environment variable: LIFERAY_DEPLOYMENT_PATH=/path/to/your/liferay/deploy // pnpm dev // To run a production build: // pnpm build
liferay-npm-bundler-improved --version
Debug
Known issues
breakingThe separate `lnbs-copy-sources` and `lnbs-copy-assets` commands from the original liferay-npm-bundler are removed. Their functionality is now integrated as direct CLI flags (`--copy-sources` and `--copy-assets`) on the `liferay-npm-bundler-improved` command.
fix
Remove `lnbs-copy-sources` and `lnbs-copy-assets` from your build scripts and instead add `--copy-sources` and `--copy-assets` directly to your `liferay-npm-bundler-improved` command.
affects: >=1.0.0
gotchaThe `--watch` mode (live instance replacement) currently functions exclusively when `vite` is used as the underlying build tool for your project. Performance may also degrade for very large bundles (build times exceeding 10 seconds).
fix
Ensure your project utilizes `vite` for bundling if you intend to use the watch mode. Consider bundle size for optimal watch mode performance.
affects: >=1.5.0-beta.1
gotchaEnabling the deployment feature with `--deploy` or `-d` requires the `LIFERAY_DEPLOYMENT_PATH` environment variable to be explicitly set. If not set, an error will be thrown.
fix
Define the `LIFERAY_DEPLOYMENT_PATH` environment variable in your shell or a `.env` file, pointing to your Liferay server's deployment directory, before running the deploy command.
affects: >=1.5.0-beta.2
gotchaThe experimental localization support for `Liferay.Language.get('key')` functions only uses the default language configured in Liferay and processes `Language.properties` files defined within the portlet itself. It does not dynamically adapt to the user's current Liferay language or utilize global language properties.
fix
Be aware of these limitations. For dynamic or global localization, manual approaches or alternative Liferay-native localization methods may still be necessary.
affects: >=1.5.0-beta.4
gotchaKey features such as package deduplication and full system configuration support are not currently implemented and are not planned for future development due to potential impact on speed or perceived low usage.
fix
Developers requiring these specific features may need to maintain manual solutions or consider the official Liferay NPM Bundler for full compatibility, understanding the performance trade-offs.
affects: *
Errors
Common errors & fixes
Error: Missing key in package.json
A required key, such as 'name' or 'version', is missing or malformed in your project's `package.json` file.
fix
Verify that your `package.json` contains all necessary fields and that they are correctly formatted according to npm standards.
Error: Missing entry file
The bundler could not locate the main entry file (e.g., `src/index.js` or specified in `main` field) for your portlet bundle.
fix
Ensure that the entry file specified in your `package.json` (or the default expected path) exists and is accessible.
Error: LIFERAY_DEPLOYMENT_PATH environment variable not set. Please set the environment variable.
The `--deploy` or `-d` flag was used without defining the `LIFERAY_DEPLOYMENT_PATH` environment variable, which specifies the target deployment directory.
fix
Set the `LIFERAY_DEPLOYMENT_PATH` environment variable to the absolute path of your Liferay server's deployment folder (e.g., `LIFERAY_DEPLOYMENT_PATH=/opt/liferay/deploy`) before running the build command with deployment enabled.
Upgrade
Version history
1.5.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

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