liferay-npm-bundler-plugin-exclude-imports is a plugin designed for the liferay-npm-bundler tool, currently at version 2.32.2. Its core function is to allow developers to explicitly exclude specific imported dependencies from the final JavaScript bundle generated for Liferay DXP projects. This is critical for managing bundle sizes and leveraging Liferay's OSGi module runtime, where certain dependencies might be provided globally or by other deployed modules, preventing duplication. While it facilitates fine-grained control over bundling, the liferay-npm-bundler itself, and by extension this plugin, has been officially deprecated as of Liferay 2024 Q4/Portal GA129, with plans for future removal in favor of standard JavaScript tooling like Esbuild, Webpack, or Vite. Releases are part of the broader liferay-frontend-projects monorepo, suggesting its lifecycle is tied to the evolution of Liferay's frontend tooling, although this specific package does not have frequent individual releases. It's a key tool for legacy Liferay DXP projects requiring fine-grained control over OSGi-compliant module bundling.
npm install liferay-npm-bundler-plugin-exclude-importsVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to configure the plugin in a Liferay project's `.npmbundlerrc` file to exclude specific dependencies like 'some-common-utility' or 'react' from being bundled for either all modules or a specific module, leveraging Liferay's OSGi runtime for provision. The `excludedPackages` property is a hypothetical common configuration option for such a plugin.
Migrate your Liferay frontend projects to use modern standard JavaScript bundlers like Esbuild, Webpack, or Vite. Consult Liferay's official migration guides for updated best practices on migrating away from the liferay-npm-bundler ecosystem.
Thoroughly verify that any excluded dependency is indeed available at runtime via Liferay's module system. Use Liferay's module debug tools to inspect available modules. Avoid excluding critical application dependencies unless explicitly instructed or certain of their external provision by the Liferay platform or other OSGi bundles.
Double-check `.npmbundlerrc` syntax and placement according to Liferay documentation for bundler plugins. If issues persist, enable `dump-report: true` in your `.npmbundlerrc` to generate a detailed HTML report for debugging the bundler's processing and plugin application.
Review your `.npmbundlerrc` configuration and ensure 'some-dependency-name' is either removed from the exclusion list, or confirm that it is correctly provided by another OSGi bundle or the Liferay runtime. Inspect the generated OSGi bundle to verify its contents.
Verify that `liferay-npm-bundler-plugin-exclude-imports` is correctly installed in your project's `node_modules`. Check for typos in the plugin name `"exclude-imports"` within your `.npmbundlerrc` file under the `plugins` array. Ensure the `.npmbundlerrc` file is valid JSON and correctly placed.