{"id":18982,"library":"babel-compile","title":"babel-compile","description":"A CLI tool built on babel-core for compiling .js/.jsx files to ES6 with automatic source map generation, output directory cleaning, and configuration loading from NPM modules. Version 2.0.0 is the current stable release with low release cadence. It provides an alternative to the Babel CLI for batch compilation with extra features like source maps with correct file references and cleaning the output directory to avoid stale files. It requires a Babel preset (e.g., babel-preset-es2015).","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/jhford/babel-compile","tags":["javascript","taskcluster","babel"],"install":[{"cmd":"npm install babel-compile","lang":"bash","label":"npm"},{"cmd":"yarn add babel-compile","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-compile","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for ES2015 compilation; babel-compile itself does not include presets.","package":"babel-preset-es2015","optional":false}],"imports":[{"note":"This is a CLI tool, not a module. Use npx or install globally. No JavaScript import exists.","wrong":"require('babel-compile')","symbol":"babel-compile (CLI)","correct":"npx babel-compile -p es2015 src:lib"},{"note":"The package does not export a public API for programmatic use.","symbol":"compile function (internal)","correct":"Not intended for direct import; use CLI only."}],"quickstart":{"code":"npm install babel-compile --save-dev\nnpm install babel-preset-es2015 --save-dev\n\n# Add to package.json scripts:\n# \"compile\": \"babel-compile -p es2015 src:lib\"\n# Run:\nnpm run compile","lang":"javascript","description":"Shows installation and basic usage of babel-compile CLI with es2015 preset, compiling src/ to lib/."},"warnings":[{"fix":"Install source-map-support and require it in your entry point.","message":"Source maps require Node >=0.12 or source-map-support module for proper stack traces.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Rename files to .js or .jsx, or use a different compiler.","message":"The tool only works with .js and .jsx files; other extensions are ignored.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run: npm install babel-preset-es2015 --save-dev","cause":"babel-compile requires an explicit preset to be installed; it does not ship with one.","error":"Error: Cannot find module 'babel-preset-es2015'"},{"fix":"Ensure babel-preset-es2015 (or appropriate preset) is installed and passed via -p option.","cause":"Compiled output may still contain ES6 features if a preset is not provided or configured correctly.","error":"SyntaxError: Unexpected token import"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}