{"id":19154,"library":"babel-plugin-replace-ts-export-assignment","title":"babel-plugin-replace-ts-export-assignment","description":"A Babel plugin that enables TypeScript's `export =` assignment syntax to be used when compiling with `@babel/preset-typescript`. It transforms `export =` into `module.exports =` to maintain CommonJS semantics. Current version 0.0.2 is a minimal, single-purpose plugin with no active development since late 2022. Key differentiators: lightweight and focused, no configuration needed, works seamlessly with `@babel/preset-typescript`. Release cadence is low; only two minor versions exist.","status":"maintenance","version":"0.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/G-Rath/babel-plugin-replace-ts-export-assignment","tags":["javascript","Babel","TypeScript","typescript"],"install":[{"cmd":"npm install babel-plugin-replace-ts-export-assignment","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-replace-ts-export-assignment","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-replace-ts-export-assignment","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as a peer dependency to function as a Babel plugin.","package":"@babel/core","optional":false}],"imports":[{"note":"Plugin is ESM-only. CommonJS require will fail if using default export; named export also available.","wrong":"const replaceTSExportAssignment = require('babel-plugin-replace-ts-export-assignment')","symbol":"default","correct":"import replaceTSExportAssignment from 'babel-plugin-replace-ts-export-assignment'"},{"note":"Named export available for compatibility.","wrong":null,"symbol":"replaceTSExportAssignment","correct":"import { replaceTSExportAssignment } from 'babel-plugin-replace-ts-export-assignment'"}],"quickstart":{"code":"// babel.config.js\nmodule.exports = {\n  presets: [\n    \"@babel/preset-env\",\n    \"@babel/preset-typescript\"\n  ],\n  plugins: [\n    \"babel-plugin-replace-ts-export-assignment\"\n  ]\n};\n\n// source.ts\nexport = { foo: \"bar\" };\n\n// After Babel transform:\n// \"use strict\";\n// module.exports = { foo: \"bar\" };","lang":"javascript","description":"Demonstrates adding the plugin to Babel config and transforming `export =` into `module.exports`."},"warnings":[{"fix":"Ensure `@babel/preset-typescript` is in your Babel presets.","message":"Plugin only works with `@babel/preset-typescript`; other TypeScript presets may not support `export =`.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure the `export =` statement is syntactically correct with a valid expression.","message":"Transformation is a simple text replacement; it does not check for JavaScript syntax errors after replacement.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use only one plugin that modifies module.exports to avoid overwrites.","message":"This plugin modifies `module.exports` directly, which may conflict with other plugins or corejs polyfills.","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":"Run `npm install --save-dev babel-plugin-replace-ts-export-assignment`.","cause":"Plugin not installed or not in node_modules.","error":"Error: [BABEL] ...: Cannot find module 'babel-plugin-replace-ts-export-assignment'"},{"fix":"Ensure the plugin is listed in Babel config and `@babel/preset-typescript` is installed.","cause":"Plugin not active or Babel preset missing; TypeScript export assignment not compiled.","error":"SyntaxError: 'import' and 'export' may only appear at the top level"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}