Registry /
devops / babel-plugin-namespace-amd-define
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import plugin from 'babel-plugin-namespace-amd-define'
✗ const { namespaceAmdDefine } = require('babel-plugin-namespace-amd-define')
ESM default import is the correct way to import the plugin for programmatic use.
plugin as
✓ // In .babelrc or babel.config.js:
module.exports = { plugins: ['namespace-amd-define'] }
✗ module.exports = { plugins: ['babel-plugin-namespace-amd-define'] }
When using string shorthand in Babel config, omit the 'babel-plugin-' prefix.
with options
✓ module.exports = { plugins: [['namespace-amd-define', { namespace: 'MyApp' }]] }
✗ module.exports = { plugins: [{ name: 'namespace-amd-define', options: { namespace: 'MyApp' } }] }
Options are passed as the second element of an array, not as an object property.
Configures Babel to prefix AMD define() calls with a custom namespace.
// babel.config.js
module.exports = {
plugins: [
[
'namespace-amd-define',
{ namespace: 'window.MyApp' }
]
]
};
// Input: define(['dep'], function() { });
// Output: window.MyApp.define(['dep'], function() { });
Errors
Common errors & fixes
Error: Cannot find module 'babel-plugin-namespace-amd-define'
Plugin not installed or incorrect import in Babel config.
fixRun 'npm install --save-dev babel-plugin-namespace-amd-define' and use shorthand 'namespace-amd-define' in plugin list.
TypeError: plugin is not a function
Plugin was imported using default import but used incorrectly.
fixUse the plugin as a string in Babel config: 'namespace-amd-define'.
Windows path issues when using absolute paths in options
The plugin may not normalize backslashes on Windows.
fixUse forward slashes or path.resolve() to create cross-platform paths.
Audit
Dependencies
@babel/corerequiredRequires Babel core to run