Transforms modules / require to AMD modules, only if they aren't already AMD modules or require configs.
$ npm install @zakodium/babel-plugin-transform-modules-amdThis is the recommended configuration to support all import, export and CJS require statements.
export default {
plugins: [
"@babel/plugin-transform-destructuring",
"@babel/plugin-transform-export-namespace-from",
"@zakodium/babel-plugin-transform-modules-amd",
],
};All import and export statements are supported, but some require to setup your babel config with additional plugins to work.
// ⚠️ Descructuring in CJS require statements is not supported out of the box.
// Use the "@babel/plugin-transform-destructuring" plugin in your babel config to support this syntax.
const { foo } = require("bar");
// ⚠️ Star exports to a namespace is not supported out of the box.
// Use the "@babel/plugin-transform-export-namespace-from" plugin in your babel config to support this syntax.
export * as foo from "bar";See LICENSE.md