Liferay NPM Bundler Angular Dependencies Injector
raw JSON →The `liferay-npm-bundler-plugin-inject-angular-dependencies` package is a specialized plugin for `liferay-npm-bundler` designed to address the challenges of deploying Angular applications within Liferay Portal's npm architecture. Its primary function is to automatically inject necessary peer dependencies (such as `rxjs` for `@angular/forms`) that the Liferay NPM Bundler may not correctly resolve or bundle by default. This ensures Angular packages function correctly at runtime, preventing 'module not found' errors. As of version 1.8.0, it remains critical for bridging the gap until `liferay-npm-bundler` offers full, native `peerDependency` support. The plugin determines the correct dependency versions by scanning the output `node_modules` directory. Its release cadence is typically tied to updates and maintenance within the broader Liferay ecosystem, focusing on compatibility and stability for Angular projects in Liferay Portal.
Common errors
error Cannot find module 'rxjs' or similar 'module not found' errors at runtime for Angular peer dependencies. ↓
"inject-angular-dependencies" to the plugins array in your .npmbundlerrc file to ensure these dependencies are forcibly injected. error Zone.js has detected that ZoneAwarePromise is overwritten. ↓
liferay-npm-bundler-plugin-inject-angular-dependencies is correctly configured and that no other bundling plugins or manual configurations are causing duplicate or conflicting injections of core Angular libraries. Warnings
gotcha The `dependenciesMap` option is explicitly noted as a temporary workaround. Its use is discouraged except to bypass specific, unaddressed errors, and its behavior or availability may change in future versions. ↓
breaking This plugin mitigates the `liferay-npm-bundler`'s incomplete `peerDependency` support. If `liferay-npm-bundler` introduces full native `peerDependency` handling, this plugin may become obsolete or require significant breaking changes, rendering its current usage incorrect. ↓
gotcha Improper configuration of this plugin, or conflicts with other bundling configurations, can lead to unintended dependency injection, duplicate modules, or unexpected runtime behavior in Angular applications. ↓
Install
npm install liferay-npm-bundler-plugin-inject-angular-dependencies yarn add liferay-npm-bundler-plugin-inject-angular-dependencies pnpm add liferay-npm-bundler-plugin-inject-angular-dependencies Imports
- inject-angular-dependencies wrong
import { InjectAngularDependencies } from 'liferay-npm-bundler-plugin-inject-angular-dependencies';correct{ "*": { "plugins": ["inject-angular-dependencies"] } }
Quickstart
{
"*": {
"plugins": ["inject-angular-dependencies"]
}
}