Liferay npm Bundler Plugin for Create React App

2.14.1 · deprecated · verified Tue Apr 21

The `liferay-npm-bundler-plugin-create-react-app` is a specialized plugin designed to facilitate the integration of projects bootstrapped with Create React App (CRA) into the Liferay Portal environment. It works in conjunction with `liferay-npm-bundler` to transform standard CRA output into OSGi bundles, making them deployable as Liferay widgets or portlets. This plugin manages the necessary adaptations for module loading, asset paths, and other build configurations specific to Liferay's ecosystem, which typically relies on an AMD loader. While the current stable version is 2.14.1, the underlying `liferay-npm-bundler` toolset is deprecated as of Liferay 2024.Q4 (Portal GA129) and is planned for future removal, meaning this plugin is primarily relevant for older Liferay DXP/Portal versions. Its key differentiator is simplifying the process of making CRA projects compatible with Liferay's unique bundling requirements without extensive manual configuration.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to enable the `create-react-app` plugin in a `.npmbundlerrc` file for Liferay's npm bundler to process a Create React App project.

{
  "//": "This .npmbundlerrc file configures the Liferay npm Bundler for a Create React App project.",
  "//": "It activates the 'create-react-app' plugin to handle CRA-specific build adjustments.",
  "*": { "plugins": [ "create-react-app" ] },
  "//": "For a comprehensive setup, the 'liferay-npm-bundler-preset-create-react-app' preset is often preferred:",
  "//": "{\n  \"preset\": \"liferay-npm-bundler-preset-create-react-app\"\n}",
  "//": "This example assumes a standard Create React App project structure.",
  "//": "Ensure your package.json name is unique and follows Liferay's naming conventions for client extensions.",
  "//": "To build, navigate to your project root and run: npx liferay-npm-bundler"
}

view raw JSON →