Registry / devops / liferay-npm-bundler-preset-amd

liferay-npm-bundler-preset-amd

JSON →
library1.8.0jsnpmunverified

The `liferay-npm-bundler-preset-amd` package provides a specialized configuration preset for the `liferay-npm-bundler`, a tool integral to developing modules for Liferay DXP. Its core function is to facilitate the bundling of projects that rely on AMD (Asynchronous Module Definition) structured npm modules, making them compatible with the Liferay portal environment. Currently stable at version 1.8.0, this preset streamlines the build process by embedding the necessary Babel transformations, notably `babel-preset-liferay-amd`, which handles AMD-specific syntax and dependencies. While a strict release cadence isn't published, updates typically align with major `liferay-npm-bundler` or Liferay DXP platform releases, ensuring ongoing compatibility. A key differentiator is its deep integration with the Liferay ecosystem, providing an opinionated and optimized approach for handling legacy or specifically designed AMD modules within modern Liferay development workflows, avoiding manual configuration of complex Babel and Webpack rules for AMD support.

npm install liferay-npm-bundler-preset-amd
INSTALL
IMPORT
SIG · LIFERAY-NPM-BUNDLE
L
liferay-npm-bundler-preset-amd
devopsjavascriptv1.8.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

preset
{ "preset": "liferay-npm-bundler-preset-amd" }
The preset is applied by specifying its package name as a string value for the 'preset' field in your project's .npmbundlerrc configuration file. This is the primary method of 'importing' this preset.
LiferayAmdPresetESM
import LiferayAmdPreset from 'liferay-npm-bundler-preset-amd';
This package exports a configuration preset for a build tool, not a JavaScript module for direct programmatic import via ES Module syntax in application code. Attempting to import it directly will result in runtime errors or an empty module.
liferayAmdPresetCJS
const LiferayAmdPreset = require('liferay-npm-bundler-preset-amd');
Similar to ESM imports, this package is not designed for direct CommonJS require statements. It is purely a declarative configuration for the liferay-npm-bundler tool and does not expose a programmatic API.

Demonstrates how to activate the AMD preset for the `liferay-npm-bundler` by modifying the project's `.npmbundlerrc` configuration file. This file must be located at the root of your project.

// .npmbundlerrc { "preset": "liferay-npm-bundler-preset-amd" }
Debug
Known issues
breakingMajor version updates to the core `liferay-npm-bundler` package can introduce breaking changes that might require an update or specific version constraints for this preset to function correctly.
fix
Always consult the `liferay-npm-bundler` release notes for compatibility when upgrading. Pin exact versions of bundler and preset in package.json to avoid unexpected updates.
affects: >=1.0.0
breakingChanges in the underlying Babel presets, specifically `babel-preset-liferay-amd`, which this preset relies on, can lead to unexpected build failures or altered module transformations.
fix
Monitor the changelog for `babel-preset-liferay-amd` and related Babel packages. Test builds thoroughly after any `npm update` or `yarn upgrade`.
affects: >=1.0.0
gotchaThis preset might conflict with other custom Babel configurations or additional `liferay-npm-bundler` plugins if not carefully managed, potentially leading to incorrect module transformations or build errors.
fix
Ensure that your `.npmbundlerrc` and `babel.config.js` files do not have conflicting rules. Consider using explicit `extends` or `overrides` if combining configurations.
affects: >=1.0.0
gotchaIncorrect module resolution for specific AMD modules, especially those with non-standard paths or complex dependency trees, can occur if not explicitly handled by the preset or custom bundler configuration.
fix
For problematic modules, check `liferay-npm-bundler` documentation for path aliases or custom resolver configurations. Verify the `baseUrl` and `paths` settings if applicable within your project.
affects: >=1.0.0
gotchaThe extensive transformations required for AMD modules can lead to increased build times, particularly in large projects with many dependencies.
fix
Analyze build performance using bundler statistics. Consider optimizing the project's module structure or gradually migrating away from AMD if feasible for critical performance paths.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Preset "liferay-npm-bundler-preset-amd" not found
The `liferay-npm-bundler-preset-amd` package was not installed or is misspelled in `.npmbundlerrc`.
fix
Ensure `npm install --save-dev liferay-npm-bundler-preset-amd` has been run and the package name in `.npmbundlerrc` is exactly 'liferay-npm-bundler-preset-amd'.
ERROR in ./.npmbundlerrc Configuration validation error: "preset" must be a string
The `preset` value in `.npmbundlerrc` is not a simple string, but an object or array.
fix
Modify `.npmbundlerrc` to set `"preset": "liferay-npm-bundler-preset-amd"` as a direct string value.
ModuleNotFoundError: Module not found: Error: Can't resolve 'some-amd-module' in '/path/to/project'
The bundler could not locate an AMD module required by your project, often due to incorrect paths or missing `baseUrl` configuration.
fix
Verify that 'some-amd-module' is correctly installed and accessible. Check for any custom `baseUrl` or `paths` settings in your `.npmbundlerrc` or `webpack.config.js` if you are using custom module resolution.
SyntaxError: 'import' and 'export' may only appear with 'sourceType: module'
A module is being treated as CommonJS by Babel despite containing ES Module syntax, indicating a misconfiguration in Babel or the preset.
fix
Ensure that your Babel configuration (or the preset's internal Babel configuration) correctly identifies the `sourceType` for your modules. This might involve checking the `babel-preset-liferay-amd` or adding a specific Babel plugin.
Upgrade
Version history
1.8.0latest on npm
Audit
Dependencies
liferay-npm-bundlerrequiredThis package is a configuration preset for liferay-npm-bundler and requires it to be installed in the project for bundling operations.
Agent activity
2 hits · last 30 days
node
2
Resources
liferay-npm-bundler-preset-amd — npm install liferay-npm-bundler-preset-amd · libregistry