Registry /
devops / babel-plugin-module-extension
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.
babel-plugin-module-extension
✓ // Use in .babelrc as plugin reference
{
"plugins": [
["module-extension", { "less": "css", "js": "" }]
]
}
✗ import plugin from 'babel-plugin-module-extension';
// Works only in modern JavaScript, not as Babel plugin API
Used as a Babel plugin name in config, not imported directly.
require('babel-plugin-module-extension')
✓ const plugin = require('babel-plugin-module-extension');
CommonJS require for Node.js or e2e test setups.
plugin function
✓ import plugin from 'babel-plugin-module-extension';
✗ const plugin = require('babel-plugin-module-extension').default;
// No default export, returns function directly
ESM import returns the plugin function directly. No .default needed.
Configures module-extension plugin to replace .less with .css and .ts with .js in import statements.
// Run via Babel CLI or programmatic API.
// Example .babelrc
{
"plugins": [
["module-extension", {
".less": ".css",
".ts": ".js"
}]
]
}
// Input: import styles from './style.less';
// Output: import styles from './style.css';
Errors
Common errors & fixes
Error: Module side-effects are not supported.
Babel plugin runs on import statements only, not dynamic requires or side-effect imports.
fixUse explicit imports for side-effect modules.
TypeError: Cannot read property 'includes' of undefined
Missing options object in plugin config.
fixProvide at least an empty object: ["module-extension", {}]. babel-plugin-module-extension: Unrecognized extension ''
Empty string as target for an extension mapping without dot prefix.
fixUse an empty string with dot prefix for removal: {".js": ""}. Audit
Dependencies
No dependency data recorded yet.