{"id":18999,"library":"babel-helper-simplify-module","title":"babel-helper-simplify-module","description":"This package provides Babel utilities to transform and simplify module structures by exploding imports and exports into a normalized form. Current stable version is 2.2.1, with low release cadence. It is intended for internal use in Babel tooling, not for direct consumption in most projects. It differs from alternatives like babel-plugin-transform-modules-commonjs by focusing on structure normalization rather than module system conversion. Typically used in conjunction with babel-explode-module.","status":"maintenance","version":"2.2.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/thejameskyle/babel-helper-simplify-module","tags":["javascript"],"install":[{"cmd":"npm install babel-helper-simplify-module","lang":"bash","label":"npm"},{"cmd":"yarn add babel-helper-simplify-module","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-helper-simplify-module","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for exploding module AST nodes into structured data","package":"babel-explode-module","optional":false}],"imports":[{"note":"This package only exports named exports; no default export is available.","wrong":"import simplifyModule from 'babel-helper-simplify-module'","symbol":"simplifyModule","correct":"import { simplifyModule } from 'babel-helper-simplify-module'"},{"note":"CommonJS require is valid as the package supports both ESM and CJS.","wrong":"const { explodedToStatements } = require('babel-helper-simplify-module')","symbol":"explodedToStatements","correct":"import { explodedToStatements } from 'babel-helper-simplify-module'"}],"quickstart":{"code":"import { simplifyModule } from 'babel-helper-simplify-module';\nimport { parse, traverse } from '@babel/core';\n\nconst code = `\nimport foo from 'mod';\nimport { bar } from 'mod';\nexport default function() {}\nexport const baz = 42;\nexport * from 'bam';\n`;\n\nconst ast = parse(code, { sourceType: 'module' });\ntraverse(ast, {\n  Program(path) {\n    simplifyModule(path);\n    path.stop();\n  }\n});\n\n// simplified AST is now in ast\nconsole.log(JSON.stringify(ast, null, 2));","lang":"javascript","description":"Demonstrates importing simplifyModule and using it on a Babel AST program path to normalize module structure."},"warnings":[{"fix":"Ensure you pass a valid Babel NodePath to simplifyModule.","message":"simplifyModule mutates the program path in place; always call it within a Babel traversal","severity":"gotcha","affected_versions":">=2.0"},{"fix":"Switch to @babel/helper-module-transforms if possible.","message":"This package is no longer actively maintained; consider using @babel/helper-module-transforms for similar functionality","severity":"deprecated","affected_versions":">=2.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure you call simplifyModule on a Program path, e.g., traverse with Program enter.","cause":"Passing a path that is not a Program node to simplifyModule","error":"TypeError: Cannot read properties of undefined (reading 'node')"},{"fix":"Run 'npm install babel-helper-simplify-module'","cause":"Package not installed","error":"Module not found: Can't resolve 'babel-helper-simplify-module'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}