Registry / http-networking / babel-plugin-replace-ts-export-assignment

babel-plugin-replace-ts-export-assignment

JSON →
library0.0.2jsnpmunverified

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.

npm install babel-plugin-replace-ts-export-assignment
INSTALL
IMPORT
SIG · BABEL-PLUGIN-REPLA
B
babel-plugin-replace-ts-export-assignment
http-networkingjavascriptv0.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import replaceTSExportAssignment from 'babel-plugin-replace-ts-export-assignment'
const replaceTSExportAssignment = require('babel-plugin-replace-ts-export-assignment')
Plugin is ESM-only. CommonJS require will fail if using default export; named export also available.
replaceTSExportAssignment
import { replaceTSExportAssignment } from 'babel-plugin-replace-ts-export-assignment'
Named export available for compatibility.

Demonstrates adding the plugin to Babel config and transforming `export =` into `module.exports`.

// babel.config.js module.exports = { presets: [ "@babel/preset-env", "@babel/preset-typescript" ], plugins: [ "babel-plugin-replace-ts-export-assignment" ] }; // source.ts export = { foo: "bar" }; // After Babel transform: // "use strict"; // module.exports = { foo: "bar" };
Debug
Known issues
gotchaPlugin only works with `@babel/preset-typescript`; other TypeScript presets may not support `export =`.
fix
Ensure `@babel/preset-typescript` is in your Babel presets.
affects: >=0.0.0
gotchaTransformation is a simple text replacement; it does not check for JavaScript syntax errors after replacement.
fix
Ensure the `export =` statement is syntactically correct with a valid expression.
affects: >=0.0.0
gotchaThis plugin modifies `module.exports` directly, which may conflict with other plugins or corejs polyfills.
fix
Use only one plugin that modifies module.exports to avoid overwrites.
affects: >=0.0.0
Errors
Common errors & fixes
Error: [BABEL] ...: Cannot find module 'babel-plugin-replace-ts-export-assignment'
Plugin not installed or not in node_modules.
fix
Run `npm install --save-dev babel-plugin-replace-ts-export-assignment`.
SyntaxError: 'import' and 'export' may only appear at the top level
Plugin not active or Babel preset missing; TypeScript export assignment not compiled.
fix
Ensure the plugin is listed in Babel config and `@babel/preset-typescript` is installed.
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies
@babel/corerequiredRequired as a peer dependency to function as a Babel plugin.
Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
2
Resources
babel-plugin-replace-ts-export-assignment — npm install babel-plugin-replace-ts-export-assignment · libregistry