A Babel plugin that converts AMD modules (using define()) to ES modules (import/export). Version 2.0.4 includes features like arrow function support, handling ES module dependencies (since v2.0.0), and options for rootDir and alias. It is actively maintained with bug fixes and documentation updates. Key differentiator: it specifically targets AMD-to-ESM conversion for legacy codebases, with support for handling mixed AMD/ESM dependency graphs, unlike generic AMD transform tools.
npm install babel-plugin-amd-to-esmVerified import paths — ran on the pinned version, not inferred.
Configures babel-plugin-amd-to-esm in .babelrc.js with all options: handleESMDependencies, rootDir, and alias.
Upgrade to >=2.0.0 and set handleESMDependencies: true to use these options.
Use .babelrc.js with module.exports = { ... } or .babelrc.mjs for ESM.Manually refactor dynamic requires or use a different tool for dynamic imports.
Check generated imports and update code relying on default import behavior; migrate to v2.0.0.
npm install --save-dev @babel/core babel-plugin-amd-to-esm
npm install --save-dev babel-plugin-amd-to-esm
Ensure rootDir and alias point to existing directories and dependency paths are correct.