Liferay NPM Bundler Standard Preset

2.32.2 · active · verified Tue Apr 21

This package provides a standard configuration preset for `liferay-npm-bundler`, Liferay's specialized tool for bundling npm modules into a format compatible with the Liferay Portal frontend. It aims to simplify the setup for typical Liferay frontend projects by encapsulating common Babel presets, such as `babel-preset-liferay-standard`, and bundler plugins like `liferay-npm-bundler-plugin-replace-browser-modules`. The current stable version, as per the provided context, is 2.32.2. While its specific release cadence isn't explicitly detailed, the `liferay-frontend-projects` monorepo, where this package resides, shows frequent updates across its various components, indicating active maintenance and regular releases. Its key differentiator is its tight integration and specific optimizations for the Liferay Portal environment, handling module resolution, bundling, and compatibility concerns unique to that platform, making it an essential tool for Liferay developers building OSGi-compliant frontend modules.

Common errors

Warnings

Install

Quickstart

This quickstart demonstrates how to set up a basic Liferay module, install `liferay-npm-bundler` and its `standard` preset, and configure them via `package.json` and `.npmbundlerrc` to bundle a simple JavaScript file.

// package.json
{
  "name": "my-liferay-module",
  "version": "1.0.0",
  "private": true,
  "devDependencies": {
    "liferay-npm-bundler": "^2.0.0",
    "liferay-npm-bundler-preset-standard": "^2.0.0"
  },
  "scripts": {
    "build": "liferay-npm-bundler"
  }
}

// .npmbundlerrc (create this file in your project root)
{
  "preset": "liferay-npm-bundler-preset-standard",
  "output": {
    "folder": "build/resources/main/META-INF/resources"
  },
  "create-jar": false
}

// src/main.js (example source file)
console.log('Hello from Liferay Bundled Module!');


// Terminal commands to run
// npm install
// npm run build

view raw JSON →