{"id":25240,"library":"es6-module-transpiler-amd-formatter","title":"ES6 Module Transpiler AMD Formatter","description":"An output formatter plugin for es6-module-transpiler that compiles ES6 module syntax into AMD define() format supported by RequireJS. Version 0.3.0 is the latest stable release; the project is in maintenance mode with no active development. It converts subsets of ES6 module syntax (import/export) into AMD-compatible code, supporting default exports, named exports, and re-exports. Unlike other transpilers like Babel, this plugin is tightly coupled to the now-deprecated es6-module-transpiler ecosystem and requires esprima for parsing. It compromises on ES6 features like live bindings and sealed objects to enable AMD compatibility. Requires Node.js and the es6-module-transpiler package at version 0.10.x.","status":"maintenance","version":"0.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/caridy/es6-module-transpiler-amd-formatter","tags":["javascript","es6","module","transpiler","amd","module-formatter"],"install":[{"cmd":"npm install es6-module-transpiler-amd-formatter","lang":"bash","label":"npm"},{"cmd":"yarn add es6-module-transpiler-amd-formatter","lang":"bash","label":"yarn"},{"cmd":"pnpm add es6-module-transpiler-amd-formatter","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core transpiler library required; this plugin provides a formatter for it.","package":"es6-module-transpiler","optional":false}],"imports":[{"note":"ES6 import syntax may not work if the package is not set up for ESM; use CommonJS require.","wrong":"import AMDFormatter from 'es6-module-transpiler-amd-formatter';","symbol":"AMDFormatter","correct":"var AMDFormatter = require('es6-module-transpiler-amd-formatter');"},{"note":"The -f flag expects the module name, not a format name. Must install both packages globally or locally.","wrong":"compile-modules convert -f AMD input.js -o output.js","symbol":"Formatter as plugin for CLI","correct":"compile-modules convert -f es6-module-transpiler-amd-formatter input.js -o output.js"},{"note":"No default export; use new on the required constructor directly.","wrong":"var formatter = require('es6-module-transpiler-amd-formatter').default;","symbol":"Container usage","correct":"var Container = require('es6-module-transpiler').Container;\nvar formatter = new (require('es6-module-transpiler-amd-formatter'))();"}],"quickstart":{"code":"// Install dependencies\n// npm install es6-module-transpiler es6-module-transpiler-amd-formatter\n\nvar transpiler = require('es6-module-transpiler');\nvar AMDFormatter = require('es6-module-transpiler-amd-formatter');\nvar Container = transpiler.Container;\nvar FileResolver = transpiler.FileResolver;\n\nvar container = new Container({\n  resolvers: [new FileResolver(['lib/'])],\n  formatter: new AMDFormatter()\n});\n\ncontainer.getModule('index');\ncontainer.write('out/mylib.js');","lang":"javascript","description":"Shows how to use the AMD formatter with the es6-module-transpiler Container API to compile ES6 modules from 'lib/' into an AMD define() output file."},"warnings":[{"fix":"Migrate to a modern transpiler like Babel with @babel/plugin-transform-modules-amd.","message":"es6-module-transpiler is no longer maintained. The AMD formatter only works with es6-module-transpiler and will not receive updates.","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"Ensure es6-module-transpiler is at version ^0.10.0.","message":"Version 0.3.0 requires es6-module-transpiler 0.10.x. Using an older version of the transpiler will cause errors.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Avoid relying on live bindings; treat exports as static values.","message":"The AMD formatter does not support live bindings or sealed objects as per ES6 specification. Exports are snapshots.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Always install and import es6-module-transpiler along with this formatter.","message":"The formatter cannot be used standalone; it must be passed as an option to es6-module-transpiler Container or CLI.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install es6-module-transpiler-amd-formatter` in your project directory.","cause":"The package is not installed or not in the Node module resolution path.","error":"Error: Cannot find module 'es6-module-transpiler-amd-formatter'"},{"fix":"Use `new (require('es6-module-transpiler-amd-formatter'))()` to instantiate the formatter.","cause":"Using the formatter module incorrectly (e.g., calling it as a function instead of using `new`).","error":"TypeError: formatter is not a constructor"},{"fix":"Install the package globally or locally, and ensure the module name is correct.","cause":"The CLI -f flag expects the formatter module name, but the module cannot be loaded (likely not installed).","error":"Error: Unknown formatter 'es6-module-transpiler-amd-formatter'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}