{"id":18986,"library":"babel-deps","title":"babel-deps","description":"Compiles JavaScript files along with all their imported dependencies using Babel, automatically resolving and compiling transitive dependencies that are not explicitly listed. Version 2.1.0 (latest) with no recent updates. Key differentiators: unlike direct Babel usage, babel-deps discovers and compiles the entire dependency graph, caches results for performance, and allows custom module resolution. Supports Node >=0.12.0 (legacy).","status":"abandoned","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/mairatma/babel-deps","tags":["javascript","babel","dependencies","deps","es6"],"install":[{"cmd":"npm install babel-deps","lang":"bash","label":"npm"},{"cmd":"yarn add babel-deps","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-deps","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package ships as CommonJS; require is also correct, but import is the modern ES module syntax.","wrong":"const babelDeps = require('babel-deps')","symbol":"babelDeps","correct":"import babelDeps from 'babel-deps'"}],"quickstart":{"code":"import babelDeps from 'babel-deps';\nimport fs from 'fs';\n\nconst files = [\n  {\n    contents: fs.readFileSync('src/index.js', 'utf8'),\n    options: { filename: 'src/index.js' }\n  }\n];\n\nconst results = babelDeps(files, {\n  babel: { presets: ['@babel/preset-env'] },\n  cache: true\n});\n\nfor (const result of results) {\n  console.log(result.filename, result.code);\n}","lang":"typescript","description":"Demonstrates compiling a file and its dependencies with Babel, using cache and custom Babel options."},"warnings":[{"fix":"Consider using a modern tool like Webpack, Babel CLI alone, or Rollup for dependency compilation.","message":"Package is no longer maintained. Last release 2.1.0 on 2016-06-13. Babel versions have changed drastically since.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Always provide `options.filename` for every file in the array.","message":"Each file object must have a `filename` in `options`. If missing, compilation will fail silently or throw.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Implement `resolveModuleToPath` function for packages that are not paths.","message":"Default module resolution assumes module sources are already absolute or relative paths. For non-path sources, provide `resolveModuleToPath`.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure each file object has `contents` and `options: { filename: 'path/to/file.js' }`.","cause":"Missing `options` or `filename` in a file entry.","error":"TypeError: Cannot read property 'filename' of undefined"},{"fix":"Provide a `resolveModuleToPath` function that converts module names to file paths.","cause":"Module source is not a valid file path and no `resolveModuleToPath` provided.","error":"Error: Module 'some-package' not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}