liferay-npm-bundler-plugin-tweak-sourcemaps (current stable version 2.32.2) is a specialized plugin designed for the Liferay DXP frontend development ecosystem. It integrates with liferay-npm-bundler to modify and correct source map paths after the bundling process, specifically for project-owned files. This addresses common issues where build artifacts generated by the Liferay NPM Bundler might have source map references that do not correctly align with the development environment, especially when deployed within an OSGi module context. The package is part of the larger `liferay-frontend-projects` monorepo, meaning its updates and maintenance are tied to the broader Liferay frontend tooling release cycle rather than having an independent cadence. Its key differentiator is its deep integration and targeted solution for source map pathing within the Liferay DXP development workflow, focusing solely on developer-authored source files and excluding third-party dependencies.
npm install liferay-npm-bundler-plugin-tweak-sourcemapsVerified import paths — ran on the pinned version, not inferred.
Installs the plugin as a development dependency and configures liferay-npm-bundler to use it by adding 'tweak-sourcemaps' to the plugins list in .npmbundlerrc. This example assumes a basic configuration without options.
Understand the plugin's scope; for third-party dependencies, external source map solutions or specific bundler configurations are needed.
Verify the plugin name 'tweak-sourcemaps' is correctly listed within the `plugins` array in your `.npmbundlerrc` configuration file.
Always refer to the official Liferay frontend projects documentation and changelogs when upgrading Liferay DXP or `liferay-npm-bundler` to ensure plugin compatibility and address any breaking changes.
Use browser developer tools to inspect source map paths (`sources` field) in the generated bundles to confirm they correctly map to your original files. Supplement with custom bundler configurations if the issue persists.
Run `npm install --save-dev liferay-npm-bundler-plugin-tweak-sourcemaps` and ensure that `"plugins": ["tweak-sourcemaps"]` is correctly defined within your `.npmbundlerrc` file.
First, verify `.npmbundlerrc` for correct plugin configuration. Then, use your browser's developer tools to inspect the generated source maps to see the `sources` array and confirm the paths. Remember that this plugin explicitly does not affect third-party (e.g., `node_modules`) source maps.