The `liferay-npm-bundler-preset-reactjs` package, currently at stable version 2.0.1, provides a pre-configured solution for integrating React applications with the Liferay Portal ecosystem. It functions as a configuration preset for the `liferay-npm-bundler`, streamlining the setup by including necessary Babel presets like `babel-preset-liferay-standard` and Liferay-specific plugins such as `liferay-npm-bundler-plugin-replace-browser-modules`. This preset is designed to adapt standard React development workflows for Liferay's widget-based architecture and its unique AMD loading mechanism. It handles complexities like package namespacing for module isolation and facilitates dependency sharing across multiple widgets, which differentiates it from generic bundlers like Webpack that produce single JavaScript files. While the preset itself is stable, the underlying `liferay-npm-bundler` is officially deprecated as of Liferay 2024.Q4/Portal GA129 and is slated for removal, encouraging developers to transition to standard JavaScript build tools like esbuild or Webpack for future projects. This impacts the long-term relevance and future release cadence of this preset, which is now primarily in a maintenance or deprecated state.
npm install liferay-npm-bundler-preset-reactjsNo compatibility data collected yet for this library.
Demonstrates how to set up a basic Liferay widget project to utilize the `liferay-npm-bundler-preset-reactjs` for automatic Babel transpilation and Liferay-specific bundling of a simple React component for deployment.
Review the Liferay documentation on 'Changes Between Bundler 1.x and 2.x' to understand new behaviors regarding module formatting, dependency isolation, and peer dependency handling.
Plan to migrate existing projects away from `liferay-npm-bundler` to modern build tools. For new projects, avoid using `liferay-npm-bundler` and its presets entirely, opting for standard JavaScript build chains compatible with Liferay DXP's browser module support.
Ensure your Liferay development environment and `liferay-npm-bundler` toolchain are up-to-date. If issues persist, verify the Babel versions used by `liferay-npm-bundler`'s internal loaders and consider manually aligning Babel configurations or upgrading Liferay's JS tooling.
Utilize Liferay's 'Shared Bundle' feature or explicitly configure `liferay-npm-bundler` to consume React from a common OSGi bundle. Ensure all widgets consuming React are configured to use the same shared version to optimize loading and avoid conflicts.
Ensure `react` and `react-dom` are properly declared as `devDependencies` in your `package.json`. Confirm that the `liferay-npm-bundler` processed your project successfully and generated the necessary `META-INF/resources` structure with React. If using Liferay's shared library feature, verify React is deployed and accessible as a global module.
Avoid mixing Webpack configurations with `liferay-npm-bundler`. If you must use Webpack, configure it independently and then integrate its output into the Liferay development workflow without relying on `liferay-npm-bundler` for the actual bundling process. Alternatively, consider fully migrating to standard build tools as recommended by Liferay.
No dependency data recorded yet.