A Babel plugin that prepends the root project's package name and version to AMD module names in define() and require() calls, preventing module name clashes across projects. This is particularly useful for sandboxing dependencies in Liferay environments, ensuring runtime dependencies match development dependencies. Version 2.32.2 is the latest stable release, maintained as part of the liferay-frontend-projects monorepo. It integrates with liferay-npm-bundler for consistent namespace handling.
npm install babel-plugin-namespace-modulesVerified import paths — ran on the pinned version, not inferred.
Shows basic installation and .babelrc configuration for namespace AMD modules with root project name.
Ensure your code uses AMD syntax or use a different plugin for CommonJS/ESM.
Use absolute-looking module names if you want them namespaced, or configure a different plugin.
Update any hardcoded references to scoped modules to match the new pattern.
Consider using general-purpose module naming plugins if outside Liferay.
Run: npm install --save-dev babel-plugin-namespace-modules
Use: { "plugins": ["namespace-modules"] }Ensure the plugin is applied and all AMD define/require calls use the namespaced name.