{"id":15452,"library":"liferay-npm-bundler-preset-standard","title":"Liferay NPM Bundler Standard Preset","description":"This package provides a standard configuration preset for `liferay-npm-bundler`, Liferay's specialized tool for bundling npm modules into a format compatible with the Liferay Portal frontend. It aims to simplify the setup for typical Liferay frontend projects by encapsulating common Babel presets, such as `babel-preset-liferay-standard`, and bundler plugins like `liferay-npm-bundler-plugin-replace-browser-modules`. The current stable version, as per the provided context, is 2.32.2. While its specific release cadence isn't explicitly detailed, the `liferay-frontend-projects` monorepo, where this package resides, shows frequent updates across its various components, indicating active maintenance and regular releases. Its key differentiator is its tight integration and specific optimizations for the Liferay Portal environment, handling module resolution, bundling, and compatibility concerns unique to that platform, making it an essential tool for Liferay developers building OSGi-compliant frontend modules.","status":"active","version":"2.32.2","language":"javascript","source_language":"en","source_url":"https://github.com/liferay/liferay-frontend-projects","tags":["javascript"],"install":[{"cmd":"npm install liferay-npm-bundler-preset-standard","lang":"bash","label":"npm"},{"cmd":"yarn add liferay-npm-bundler-preset-standard","lang":"bash","label":"yarn"},{"cmd":"pnpm add liferay-npm-bundler-preset-standard","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This package is a configuration preset for `liferay-npm-bundler`, which must be installed separately to utilize this preset.","package":"liferay-npm-bundler","optional":false}],"imports":[],"quickstart":{"code":"// package.json\n{\n  \"name\": \"my-liferay-module\",\n  \"version\": \"1.0.0\",\n  \"private\": true,\n  \"devDependencies\": {\n    \"liferay-npm-bundler\": \"^2.0.0\",\n    \"liferay-npm-bundler-preset-standard\": \"^2.0.0\"\n  },\n  \"scripts\": {\n    \"build\": \"liferay-npm-bundler\"\n  }\n}\n\n// .npmbundlerrc (create this file in your project root)\n{\n  \"preset\": \"liferay-npm-bundler-preset-standard\",\n  \"output\": {\n    \"folder\": \"build/resources/main/META-INF/resources\"\n  },\n  \"create-jar\": false\n}\n\n// src/main.js (example source file)\nconsole.log('Hello from Liferay Bundled Module!');\n\n\n// Terminal commands to run\n// npm install\n// npm run build","lang":"javascript","description":"This quickstart demonstrates how to set up a basic Liferay module, install `liferay-npm-bundler` and its `standard` preset, and configure them via `package.json` and `.npmbundlerrc` to bundle a simple JavaScript file."},"warnings":[{"fix":"Ensure you are developing for Liferay Portal and using `liferay-npm-bundler` as your module bundler. Consult Liferay's official development guides for proper environment setup.","message":"This preset is specifically designed for `liferay-npm-bundler` and the Liferay Portal ecosystem. Using it outside of a Liferay context or with other bundlers will likely result in unexpected behavior or errors due to its specialized configurations and plugins.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"When upgrading major versions of `liferay-npm-bundler` or `liferay-npm-bundler-preset-standard`, thoroughly review the `liferay-frontend-projects` monorepo changelogs for `babel-preset-liferay-standard` and related bundler plugins.","message":"Updates to underlying tools like Babel presets (e.g., `babel-preset-liferay-standard`) or bundler plugins might introduce breaking changes that are transparently adopted by this preset. Always check the `liferay-frontend-projects` monorepo's changelog for detailed version information related to these transitive dependencies.","severity":"breaking","affected_versions":"All versions"},{"fix":"Consult Liferay's official documentation for recommended Node.js versions for your specific Liferay Portal version and the associated frontend tooling. Use a Node.js version manager (e.g., `nvm` or `fnm`) to align your development environment.","message":"Compatibility with specific Node.js versions is crucial. The `liferay-frontend-projects` monorepo frequently updates components to support newer Node.js LTS versions (e.g., Node v20 support in `liferay-theme-tasks`). A mismatch can lead to build failures.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Adhere to Liferay's recommended module structure or customize the `output` path in your `.npmbundlerrc` file to match your project's layout. Ensure the `create-jar` option is set correctly for your build process.","message":"The preset's configuration expects a specific project structure for Liferay modules (e.g., output folder `build/resources/main/META-INF/resources`). Deviations from this structure without custom configuration can lead to deployment issues.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev liferay-npm-bundler-preset-standard` in your project's root directory. Verify that `.npmbundlerrc` correctly specifies the preset name.","cause":"The `liferay-npm-bundler-preset-standard` package was not installed, or `liferay-npm-bundler` cannot locate it.","error":"Error: No such preset 'liferay-npm-bundler-preset-standard' found."},{"fix":"Try clearing your `node_modules` directory and npm cache (`npm cache clean --force`), then reinstall all dependencies (`npm install`). Ensure `liferay-npm-bundler` and `liferay-npm-bundler-preset-standard` are compatible versions.","cause":"A dependency of the preset's underlying Babel configuration is missing or incompatible, often due to an incomplete `npm install` or cache issue.","error":"babel-preset-liferay-standard: Cannot find module '...' "},{"fix":"Verify that `liferay-npm-bundler` and `liferay-npm-bundler-preset-standard` are using compatible versions. Check the `liferay-frontend-projects` monorepo's release notes for guidance on compatible package versions and supported Node.js environments.","cause":"This error often indicates a version mismatch between `liferay-npm-bundler` and other `liferay-js-toolkit` packages, or a Node.js version incompatibility.","error":"TypeError: Class constructor Bundler cannot be invoked without 'new'"}],"ecosystem":"npm"}