{"id":25248,"library":"es6-module-transpiler-rewrite","title":"ES6 Module Transpiler","description":"es6-module-transpiler is an experimental compiler that allows writing JavaScript using a subset of the current ES6 module syntax, compiling it into AMD or CommonJS modules. Version 0.3.1 is the latest stable release. It provides a way to experiment with ES6 module syntax in real-world scenarios. Key differentiators: closely tracks TC39 module proposals, supports both AMD and CommonJS output, and provides a command-line interface. Note: This project is experimental and may not follow semver; syntax may change.","status":"deprecated","version":"0.3.1","language":"javascript","source_language":"en","source_url":"https://github.com/square/es6-module-transpiler","tags":["javascript","es6","module","transpile","amd","commonjs"],"install":[{"cmd":"npm install es6-module-transpiler-rewrite","lang":"bash","label":"npm"},{"cmd":"yarn add es6-module-transpiler-rewrite","lang":"bash","label":"yarn"},{"cmd":"pnpm add es6-module-transpiler-rewrite","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Require pattern for CommonJS Node environment.","wrong":"import { Compiler } from 'es6-module-transpiler';","symbol":"Compiler","correct":"var Compiler = require('es6-module-transpiler').Compiler;"},{"note":"Additionally exported; not commonly used.","wrong":null,"symbol":"Container","correct":"var Container = require('es6-module-transpiler').Container;"},{"note":"Second argument (name) is optional but recommended; options is optional.","wrong":"var compiler = new Compiler(string);","symbol":"Compiler class","correct":"var compiler = new Compiler(string, name, options);"}],"quickstart":{"code":"// Install globally (use git URL as npm package not published)\n// $ npm install -g https://git.squareup.com/javascript/es6-module-transpiler\n\n// Create an ES6 module file (example.js):\n// export var foo = 'bar';\n\n// Compile to AMD:\n// $ compile-modules example.js --to dist --type amd\n\n// Or use as library:\nvar Compiler = require('es6-module-transpiler').Compiler;\nvar code = 'export var foo = \"bar\";';\nvar compiler = new Compiler(code, 'example');\nvar amdOutput = compiler.toAMD();\nconsole.log(amdOutput);\n// Outputs: define('example', [], function() { ... });","lang":"javascript","description":"Shows both CLI usage and library usage to compile ES6 module syntax to AMD."},"warnings":[{"fix":"Use a more up-to-date transpiler like Babel or TypeScript.","message":"This package is not actively maintained and the ES6 module spec has changed significantly since its creation.","severity":"deprecated","affected_versions":">=0"},{"fix":"Refer to current ES module spec or use modern tools.","message":"Syntax may not match finalized ES6 modules; expect incompatibilities.","severity":"breaking","affected_versions":">=0"},{"fix":"Supply --imports like '--imports ember:Ember' or equivalent options hash.","message":"When using 'globals' type, you must provide --imports mapping for all imported modules.","severity":"gotcha","affected_versions":">=0"},{"fix":"Either use single file or omit --module-name.","message":"The '--module-name' option cannot be used with multiple input files.","severity":"gotcha","affected_versions":">=0"},{"fix":"Install directly from git: npm install -g <git-url>","message":"The package is hosted on a private GitHub URL; not available via npm registry.","severity":"gotcha","affected_versions":">=0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install from git: npm install -g https://git.squareup.com/javascript/es6-module-transpiler","cause":"Package not published to npm; must use git URL.","error":"Error: Cannot find module 'es6-module-transpiler'"},{"fix":"Ensure global npm modules path is in PATH, or use npx.","cause":"Global install failed or not in PATH.","error":"compile-modules command not found"},{"fix":"Run the code through the transpiler first, or use a runtime that supports ES modules.","cause":"Using ES6 module syntax in a non-transpiled environment.","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}