Transforms modules / require to AMD modules, only if they aren't already AMD modules or require configs.
$ npm install @zakodium/babel-plugin-transform-modules-amdexport default {
plugins: [
// This extra plugin is needed if you want to support destructuring when requiring modules
"@babel/plugin-transform-destructuring",
"@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 is not supported out of the box
// Make sure to add "@babel/plugin-transform-destructuring" plugin to your babel config
const { foo } = require("foo");
// ⚠️ Exporting to a namespace is not supported out of the box
// Make sure add the "@babel/plugin-transform-export-namespace-from" plugin to your babel config
export * as foo from "./foo";See LICENSE.md