Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.
/ bun-plugin-swc Public archive

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

License

Notifications You must be signed in to change notification settings

joshunrau/bun-plugin-swc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️  This package is deprecated and no longer maintained, since Bun now supports emitDecoratorMetadata.

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published