{"id":24901,"library":"amd-to-es6","title":"amd-to-es6","description":"A CLI and programmatic tool to convert AMD modules (define pattern) into ES6 module syntax. Current version 0.2.0, last updated in 2014. It handles simple cases like modules with/without dependencies and imports for side-effects, but does NOT support named define modules, multiple define per file, or UMD patterns. The library is effectively abandoned as there are more modern alternatives like jscodeshift or lebab, and no updates since 2014. It works by parsing AMD define calls and rewriting to import/export statements, with options for directory batch processing, glob patterns, and beautification via jsbeautify.","status":"abandoned","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/jonbretman/amd-to-as6","tags":["javascript"],"install":[{"cmd":"npm install amd-to-es6","lang":"bash","label":"npm"},{"cmd":"yarn add amd-to-es6","lang":"bash","label":"yarn"},{"cmd":"pnpm add amd-to-es6","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only; CommonJS require will fail because the package does not export a UMD wrapper.","wrong":"var convert = require('amd-to-es6')","symbol":"convert","correct":"import { convert } from 'amd-to-es6'"},{"note":"The package only exports a named convert function, not a default export. This pattern will result in undefined.","wrong":"const amdToEs6 = require('amd-to-es6').default","symbol":"default","correct":"import amdToEs6 from 'amd-to-es6'"},{"note":"Not exported; convertSync does not exist in this package. Use convert() which is async.","wrong":null,"symbol":"convertSync","correct":"import { convertSync } from 'amd-to-es6'"}],"quickstart":{"code":"import { convert } from 'amd-to-es6';\n\nconst amdCode = `define(['path/to/a', 'path/to/b'], function (a, b) {\n    return function (x) {\n        return a(b(x));\n    };\n});`;\n\ntry {\n    const es6Code = convert(amdCode);\n    console.log(es6Code);\n} catch (error) {\n    console.error('Conversion failed:', error.message);\n}","lang":"javascript","description":"Demonstrates programmatic conversion of an AMD module with two dependencies to ES6 module syntax using the convert function."},"warnings":[{"fix":"Consider using jscodeshift or lebab for AMD to ES6 conversion.","message":"Package is unmaintained since 2014; no support for modern JavaScript features or fixes.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Manually rename named defines to anonymous before conversion or use an alternative tool.","message":"Does not support named define modules; those will throw an error or be silently skipped.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Rewrite UMD modules to plain AMD define patterns before conversion.","message":"Does not support UMD modules where define callback is not a function literal (e.g., define(factoryFn)).","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Manually rename generated variable names after conversion.","message":"Generated variable names for dynamic requires use ugly prefixes like $__path_to_a, which may break coding standards.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use import syntax and ensure your Node.js version supports ESM, or transpile your code.","message":"The package is ESM-only; using require() will fail with ReferenceError or undefined.","severity":"breaking","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":"Use import { convert } from 'amd-to-es6' instead of require.","cause":"Incorrect import or using require on an ESM-only package.","error":"TypeError: convert is not a function"},{"fix":"Remove the name from define('name', ...) or rewrite UMD to anonymous define.","cause":"Named define modules or UMD patterns not supported.","error":"Error: Unsupported define format"},{"fix":"Ensure each file has exactly one define call with a function literal callback.","cause":"Input contains multiple define calls or invalid AMD syntax.","error":"SyntaxError: Unexpected token"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}