Liferay NPM Bundler Preset for Create React App
The `liferay-npm-bundler-preset-create-react-app` package, currently at version 2.32.2, provides a specialized configuration preset designed to integrate applications built with Facebook's `create-react-app` into the Liferay DXP or Liferay Portal CE ecosystem. It acts as an extension for the `liferay-npm-bundler`, streamlining the process of preparing React-based applications for deployment within Liferay's module architecture. This preset addresses common challenges such as module resolution, asset management, and environment setup specific to Liferay, allowing developers to leverage `create-react-app`'s conventions while ensuring compatibility with Liferay's frontend infrastructure. The package is part of the broader `liferay-frontend-projects` monorepo, which undergoes continuous development and staggered releases for its various components.
Install
-
npm install liferay-npm-bundler-preset-create-react-app -
yarn add liferay-npm-bundler-preset-create-react-app -
pnpm add liferay-npm-bundler-preset-create-react-app
Quickstart
npm install --save-dev liferay-npm-bundler-preset-create-react-app
// Then, add the following to your .npmbundlerrc file in the project root:
// (Example content of .npmbundlerrc)
{
"preset": "liferay-npm-bundler-preset-create-react-app",
"baseDir": "build" // Often 'build' for create-react-app projects
}
// After configuration, run your bundler command (e.g., 'npm run build' if configured to use the bundler)
// This example is illustrative; actual build steps depend on your project's package.json scripts.