Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@2bad/tsfix

Package Overview
Dependencies
Maintainers
3
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@2bad/tsfix

[![NPM version](https://img.shields.io/npm/v/@2bad/tsfix)](https://www.npmjs.com/package/@2bad/tsfix) [![License](https://img.shields.io/npm/l/@2bad/tsfix)](https://www.npmjs.com/package/@2bad/tsfix) [![GitHub Build Status](https://img.shields.io/github/a

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
466
increased by1.08%
Maintainers
3
Weekly downloads
 
Created
Source

TSFIX

NPM version License GitHub Build Status Code coverage Written in TypeScript

This tool ensures that your compiled JavaScript files are valid ESM by replacing or appending missing extensions in the output files.

Features

Automatically detects typescript configuration and paths. Handles all types of imports (absolute, relative, internal, dynamic etc.)

Install

npm install --save-dev @2bad/tsfix

Usage

You can use tsfix as a post-build script in your project. Add the following script to your package.json:

{
  "scripts": {
    "build": "tsc",
    "postbuild": "tsfix"
  }
}

This will run tsfix automatically after your TypeScript compilation. Alternatively, you can run tsfix manually:

npx @2bad/tsfix

Example

Consider the following TypeScript files:

// src/main.ts
import { helper } from './utils/helper.ts'

// src/utils/helper.ts
export const helper = () => 'helper function'

After running tsc, the compiled JavaScript files might look like this:

// dist/main.js
import { helper } from './utils/helper.ts'

// dist/utils/helper.js
export const helper = () => 'helper function'

Running tsfix will transform the import paths to:

// dist/main.js
import { helper } from './utils/helper.js'

Contributing

We welcome contributions! If you find a bug or want to request a new feature, please open an issue. If you want to submit a bug fix or new feature, please open a pull request.

Keywords

FAQs

Package last updated on 19 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc