{"id":24902,"library":"amd-to-es6-other","title":"AMD to ES6 module transpiler","description":"A CLI and programmatic tool to convert AMD modules (RequireJS style) into ES6 module syntax. Version 0.2.5 is the latest, released mid-2015, with no recent updates. It handles dependencies, default exports, and side-effect imports, but does not support named define, multiple defines per file, or UMD patterns. It offers options for directory conversion, file ignore patterns, and beautification via jsbeautify. Key differentiator: simple, focused conversion without bundling or transpilation of other ES6 features. Compared to alternatives like lebab or jscodeshift, this is minimal and specific.","status":"maintenance","version":"0.2.5","language":"javascript","source_language":"en","source_url":"https://github.com/1483523635/amd-to-as6-other","tags":["javascript"],"install":[{"cmd":"npm install amd-to-es6-other","lang":"bash","label":"npm"},{"cmd":"yarn add amd-to-es6-other","lang":"bash","label":"yarn"},{"cmd":"pnpm add amd-to-es6-other","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Optional dependency for beautifying output when --beautify flag is used","package":"js-beautify","optional":true}],"imports":[{"note":"The package exports a single function `convert` via named export. CommonJS require must use `.convert` property.","wrong":"const convert = require('amd-to-es6').convert;","symbol":"convert","correct":"import { convert } from 'amd-to-es6'"},{"note":"There is no default export; only named exports exist. Using default import will result in undefined.","wrong":"import * as amdToEs6 from 'amd-to-es6'","symbol":"default","correct":"import amdToEs6 from 'amd-to-es6'"},{"note":"The package provides `convertFileSync` for synchronous file conversion, but no `convertFile` asynchronous variant. Check version docs.","wrong":"import { convertFile } from 'amd-to-es6'","symbol":"convertFile","correct":"import { convertFileSync } from 'amd-to-es6'"}],"quickstart":{"code":"const { convert } = require('amd-to-es6');\nconst amdCode = `define(['path/to/a'], function (a) { return function (x) { return a(x); }; });`;\nconst es6Code = convert(amdCode);\nconsole.log(es6Code);\n// Output:\n// import a from 'path/to/a';\n// export default function (x) { return a(x); };","lang":"javascript","description":"Shows how to use the programmatic API to convert a single AMD module string to ES6 syntax."},"warnings":[{"fix":"Remove the module name from the define call before conversion.","message":"Named define modules are not supported (e.g., define('my-module', ...)). Attempting to convert such files will result in a skip or error.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Split files so each contains a single define.","message":"Files with multiple module definitions are not supported. Only one define per file is converted; others are ignored.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Rewrite UMD modules to use a literal function in the define callback.","message":"UMD style modules where the callback is not a function literal (e.g., define(factoryFn)) are not supported.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider using alternative tools like lebab or manual conversion.","message":"The package has not been updated since 2015. It may not work with modern Node.js versions or newer JavaScript syntax.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure the define call has no name, only one define per file, and the callback is a function literal.","cause":"The file contains a named define, multiple defines, or a non-literal callback function.","error":"Error: Unsupported define pattern"},{"fix":"Use `const { convert } = require('amd-to-es6');` or `import { convert } from 'amd-to-es6';`","cause":"Incorrect import: using default import instead of named import.","error":"TypeError: convert is not a function"},{"fix":"Install js-beautify globally or locally: `npm install js-beautify`","cause":"The --beautify option requires js-beautify, which is an optional dependency not installed by default in some environments.","error":"Cannot find module 'js-beautify'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}