{"id":17779,"library":"liferay-npm-bundler-preset-isomorphic","title":"Liferay NPM Bundler Isomorphic Preset","description":"This package, `liferay-npm-bundler-preset-isomorphic`, provides a specialized configuration preset for the `liferay-npm-bundler`, targeting JavaScript modules designed to run both in browser and server environments (isomorphic code) within a Liferay Portal context. It bundles `babel-preset-liferay-isomorphic` for Babel transformations and `liferay-npm-bundler-plugin-replace-browser-modules` to handle environment-specific module loading and aliasing. While version 1.8.0 is the current stable release for this preset, the underlying `liferay-npm-bundler` tool itself is officially deprecated as of Liferay 2024.Q4/Portal GA129 and is slated for removal, with Liferay shifting towards standard, non-Liferay-specific JavaScript tooling like `esbuild`. Its primary differentiator was simplifying complex Liferay-specific build configurations for isomorphic modules, but its relevance is now diminishing due to the deprecation of its core dependency.","status":"deprecated","version":"1.8.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install liferay-npm-bundler-preset-isomorphic","lang":"bash","label":"npm"},{"cmd":"yarn add liferay-npm-bundler-preset-isomorphic","lang":"bash","label":"yarn"},{"cmd":"pnpm add liferay-npm-bundler-preset-isomorphic","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This package is a configuration preset for liferay-npm-bundler and requires it to function. Note that liferay-npm-bundler itself is deprecated.","package":"liferay-npm-bundler","optional":false},{"reason":"Included by this preset for Babel transformations required for isomorphic code.","package":"babel-preset-liferay-isomorphic","optional":false},{"reason":"Included by this preset to handle browser-specific module replacements and aliasing.","package":"liferay-npm-bundler-plugin-replace-browser-modules","optional":false}],"imports":[{"note":"This package is a configuration preset, not a JavaScript module. Its 'usage' is by referencing its name within the `preset` field of your project's `.npmbundlerrc` file. It does not export any symbols for direct `import` or `require`.","wrong":"import LiferayIsomorphicPreset from 'liferay-npm-bundler-preset-isomorphic'","symbol":"preset config","correct":"{\n    \"preset\": \"liferay-npm-bundler-preset-isomorphic\"\n}"},{"note":"It is a common mistake to attempt to import or require bundler presets as if they were runtime libraries. This package serves as a declarative configuration for the `liferay-npm-bundler` and has no programmatic API.","wrong":"const isomorphicConfig = require('liferay-npm-bundler-preset-isomorphic');","symbol":"configuration reference","correct":"// Add to .npmbundlerrc: {\n//     \"preset\": \"liferay-npm-bundler-preset-isomorphic\"\n// }"},{"note":"Developers should consult the Liferay npm Bundler documentation for how to configure and extend presets, rather than looking for JavaScript exports from this package.","wrong":"import { IsomorphicPreset } from 'liferay-npm-bundler-preset-isomorphic';","symbol":"no direct code usage","correct":"// This package is used exclusively via .npmbundlerrc configuration."}],"quickstart":{"code":"npm install --save-dev liferay-npm-bundler-preset-isomorphic\n\n// Create or update your .npmbundlerrc file in your project root:\n// .npmbundlerrc\n{\n    \"preset\": \"liferay-npm-bundler-preset-isomorphic\"\n}\n\n// Then run the liferay-npm-bundler as part of your build process (e.g., in package.json scripts):\n// package.json\n// {\n//   \"scripts\": {\n//     \"build\": \"liferay-npm-bundler\"\n//   }\n// }","lang":"json","description":"Demonstrates how to install the preset and configure it in the `.npmbundlerrc` file for use with `liferay-npm-bundler`."},"warnings":[{"fix":"Plan and execute a migration of your build process away from `liferay-npm-bundler` and its associated presets to standard tooling (e.g., `esbuild`, Webpack).","message":"The `liferay-npm-bundler` tool, which this preset configures, is officially deprecated as of Liferay 2024.Q4/Portal GA129 and is slated for future removal. Liferay's recommended approach is to transition to standard JavaScript build tools like `esbuild` to manage module bundling.","severity":"breaking","affected_versions":">=1.0.0 (when used with Liferay DXP/Portal GA129+ or newer)"},{"fix":"Update your `liferay-npm-bundler` dependency to version `2.32.1` or newer to ensure compatibility and resolve transitive dependency issues.","message":"Older versions of `liferay-npm-bundler` (prior to 2.32.1) could encounter `ENOENT` errors during the build process due to unexpected breaking changes in transitive dependencies like `globby`.","severity":"breaking","affected_versions":"All versions of `liferay-npm-bundler-preset-isomorphic` when used with `liferay-npm-bundler <2.32.1`"},{"fix":"Ensure your `package.json` uses the `browser` field for aliasing isomorphic modules and migrate away from relying on `unpkg` or `jsdelivr` fields for this specific purpose.","message":"The `liferay-npm-bundler-plugin-replace-browser-modules` (a plugin utilized by this preset) changed its default `resolve.aliasFields` behavior. It previously scanned `unpkg` and `jsdelivr` fields in `package.json`, which caused problems and is no longer supported. The default now strictly uses `['browser']`. Custom configurations or `package.json` entries relying on `unpkg` or `jsdelivr` for aliasing may cease to function as expected.","severity":"gotcha","affected_versions":"Check `liferay-npm-bundler-plugin-replace-browser-modules` versions bundled within or used directly."}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Upgrade your `liferay-npm-bundler` dependency to version `2.32.1` or higher to resolve known `globby` compatibility problems.","cause":"This error during `liferay-npm-bundler` execution often indicates a file path resolution issue, commonly stemming from an incompatibility with updated transitive dependencies (e.g., `globby`) in older `liferay-npm-bundler` versions.","error":"Error: ENOENT: no such file or directory, open '...'"},{"fix":"Update `liferay-npm-bundler` to version `2.32.1` or a newer version to fix the underlying dependency incompatibility.","cause":"This specific stack trace is a known manifestation of the `globby` transitive dependency issue affecting `liferay-npm-bundler` versions older than `2.32.1`, leading to incorrect file path lookups.","error":"node:internal/fs/utils:344 throw err; ^ Error: ENOENT: no such file or directory, open '/var/jenkins_home/workspace/.../node_modules/lodash@4.17.21/minBy.js'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}