This is a specialized plugin for the `liferay-npm-bundler`, designed to automate the process of adding dependencies declared as imports within a project's `.npmbundlerrc` configuration directly into its `package.json` file. This streamlines dependency management for Liferay frontend modules, ensuring that all bundled modules are correctly listed as project dependencies, which is critical for Liferay Portal's OSGi-based module system. The current stable version of this plugin is 2.32.2. However, it's crucial to note that its host, `liferay-npm-bundler`, has been officially deprecated as of Liferay 2024.Q4/Portal GA129 and is slated for future removal. This plugin, therefore, is also considered deprecated as it relies entirely on the deprecated bundler's functionality. It served a key role in Liferay's prior frontend development workflow for packaging npm modules into OSGi bundles.
npm install liferay-npm-bundler-plugin-inject-imports-dependenciesVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install the plugin and enable it in your Liferay frontend project's `.npmbundlerrc` file to automatically inject declared import dependencies into `package.json`. **Note:** The underlying `liferay-npm-bundler` and its plugins are deprecated.
Plan migration of Liferay frontend projects away from `liferay-npm-bundler` and its plugins to modern JavaScript bundlers (esbuild, Webpack, Vite) as recommended by Liferay. Remove `liferay-npm-bundler-plugin-inject-imports-dependencies` and its configuration from `.npmbundlerrc` files.
Consult the Liferay frontend projects documentation or changelog for specific compatibility matrices. Upgrade or downgrade `liferay-npm-bundler` and related toolkit packages as needed.
Verify that `liferay-npm-bundler-plugin-inject-imports-dependencies` is listed in your `devDependencies` and that 'inject-imports-dependencies' is correctly spelled in the 'plugins` array within your `.npmbundlerrc` file. Ensure the plugin is placed in the correct `pre-process` or `post-process` phase if specified.
Ensure the plugin is correctly listed in the `plugins` array in your `.npmbundlerrc`. Double-check the structure and paths within your `imports` configuration to ensure they are valid and resolvable by the bundler. Check bundler logs for any warnings or errors during the build process.