esbuild-plugin-swc2
v0.0.3
Published
Integrates SWC compiler to ESBuild
Downloads
5
Readme
esbuild-plugin-swc2
Allows parsing of JS and TS files by SWC.
Usage
import { BuildOptions } from 'esbuild';
import { pluginSwc } from 'esbuild-plugin-swc2';
const list = JSON.parse(fs.readFileSync('package.json', 'utf-8')).browserslist;
const esbuildConfig: BuildOptions = {
plugins: [
pluginSwc({
jsc: {
parser: { tsx: true, syntax: 'typescript' },
transform: {
react: { runtime: 'automatic', useBuiltins: false },
},
},
env: { mode: 'usage', targets: list },
}),
],
};
Features
- works much faster than 'esbuild-plugin-swc'
- supports env mode 'usage' so auto-polyfills work