The `liferay-npm-bundler-loader-json-loader` package, currently at version 2.32.2, is a specialized build-time loader designed for the Liferay npm bundler ecosystem. Its core function is to transform JSON files into standard JavaScript modules, where the content of the JSON file is directly exported as a parsed JavaScript object. This enables developers to seamlessly integrate and import static JSON data within their Liferay frontend projects. As an integral component of the larger `liferay-frontend-projects` monorepo, its release schedule is aligned with broader Liferay frontend tooling updates, which occur frequently, with several related packages seeing multiple updates annually. This loader's key differentiator is its deep integration with Liferay's specific bundling and module resolution mechanisms, providing a tailored solution for Liferay-based development environments, unlike generic JSON loaders used in other bundlers like Webpack or Rollup.
npm install liferay-npm-bundler-loader-json-loaderVerified import paths — ran on the pinned version, not inferred.
This `.npmbundlerrc` configuration snippet demonstrates how to enable the JSON loader, allowing `.json` files to be imported directly into JavaScript modules within a Liferay project's build process.
Always refer to the official Liferay frontend documentation for recommended versions of core tooling. If issues arise, try updating both the loader and `liferay-npm-bundler` to their latest compatible versions.
Do not add `liferay-npm-bundler-loader-json-loader` as a runtime dependency or attempt to import it directly into your application's JavaScript code. It is solely configured via `.npmbundlerrc`.
Add or verify the presence of the JSON loader rule in your project's `.npmbundlerrc` file, ensuring the `test` regex matches your JSON files (e.g., `"test": "\\.json$"`).
Ensure `liferay-npm-bundler` is correctly installed. The `json-loader` string in `.npmbundlerrc` refers to this specific Liferay-provided loader, and no separate `npm install json-loader` is typically needed for the Liferay ecosystem.