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

bun-plugin-swc

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bun-plugin-swc

A Bun plugin for transpiling TypeScript with SWC (Speedy Web Compiler).

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

bun-plugin-swc

A Bun plugin for transpiling TypeScript with SWC (Speedy Web Compiler).

Background

As of September 2023, Bun does not support emitDecoratorMetadata, which limits its compatibility with popular libraries such as NestJS. To address this issue, this plugin transpiles TypeScript imports using SWC, then feeds the resulting JavaScript code back into Bun's default JavaScript loader.

Install

bun add --dev bun-plugin-swc

Usage

First, create a preload script to load the plugin:

preload.ts

import { plugin } from 'bun';
import swcPlugin from 'bun-plugin-swc';

void plugin(swcPlugin());

Then, add the preload script to your bunfig.toml:

bunfig.toml

preload = ["./preload.ts"]

[test]
preload = ["./preload.ts"]

For a real world example, see the example project in this repository.

FAQs

Package last updated on 19 Sep 2023

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