babel-register-ts
raw JSON → 7.0.0 verified Sat Apr 25 auth: no javascript deprecated
A temporary wrapper around @babel/register that adds support for .ts and .tsx file extensions for use with Babel's TypeScript plugin. Version 7.0.0 requires @babel/core and @babel/register as peer dependencies. This package is a minimal shim intended as a stopgap until native .ts registration support lands in Babel. It is neither actively maintained nor recommended for new projects; use @babel/register with a .babelrc that includes @babel/preset-typescript instead.
Common errors
error Error: Cannot find module 'babel-register-ts' ↓
cause missing npm install or typo in require/import
fix
Run: npm install --save-dev @babel/core @babel/register babel-register-ts
Warnings
deprecated Package is a temporary shim; no longer maintained. ↓
fix Use @babel/register with @babel/preset-typescript in .babelrc instead.
Install
npm install babel-register-ts yarn add babel-register-ts pnpm add babel-register-ts Imports
- default wrong
const register = require('babel-register-ts')correctimport 'babel-register-ts' - register wrong
import { register } from 'babel-register-ts'correctconst register = require('babel-register-ts')
Quickstart
require('@babel/register')({ extensions: ['.ts', '.tsx', '.js', '.jsx'] });
require('babel-register-ts');
const example = require('./example.ts');
console.log(example);