The `liferay-npm-bundler-loader-babel-loader` package is a specialized loader designed for the Liferay npm bundler, enabling the transformation of source files using Babel within Liferay DXP frontend module build processes. As of version 2.32.2, it provides a crucial bridge for Liferay developers to leverage modern JavaScript features, JSX, and TypeScript (via Babel) by applying Babel transformations defined through `.npmbundlerrc` rules. It is part of the larger `liferay-frontend-projects` monorepo, which generally sees continuous development and frequent updates across its various components, though specific release cadences for individual loaders like this one are tied to the broader toolkit updates. Its primary differentiation is its tight integration into the Liferay build toolchain, offering a streamlined path for compiling modern frontend code for deployment within the Liferay ecosystem.
npm install liferay-npm-bundler-loader-babel-loaderVerified import paths — ran on the pinned version, not inferred.
Demonstrates the essential configuration for `liferay-npm-bundler-loader-babel-loader` in a `.npmbundlerrc` file, applying Babel with `env` and `react` presets to JavaScript files.
Plan to migrate your Liferay frontend projects away from `liferay-npm-bundler` and its associated loaders to modern, standard JavaScript bundlers and build tools. Refer to Liferay documentation on 'Moving from AMD to Browser Modules in Liferay DXP'.
Run `npm install --save-dev @babel/core babel-loader @babel/preset-env @babel/preset-react` (adjust presets/plugins as per your project's needs).
Only use loaders specifically designed for or compatible with `liferay-npm-bundler`. Do not attempt to reuse Webpack loaders directly.
Ensure `liferay-npm-bundler` is at version `2.32.1` or later to mitigate known transitive dependency issues. Regularly update frontend tooling to avoid similar problems.
Install `babel-loader` as a development dependency: `npm install --save-dev babel-loader`.
Install the missing preset: `npm install --save-dev @babel/preset-env` (or the specific preset/plugin that caused the error).
Review your `babel-loader` options in `.npmbundlerrc` and ensure all necessary presets (e.g., `react` for JSX, `typescript` for TypeScript) and plugins are correctly specified and installed.
Adjust the `test` regex in your `.npmbundlerrc` to correctly match the files you intend to process, and verify the `exclude` pattern isn't unintentionally preventing files from being handled.