complugin-swc
v1.2.0
Published
complugin to compile bundles with the swc.
Downloads
27
Maintainers
Readme
complugin-swc
Complugin to compile bundles with the SWC
.
Install
npm
$ npm install complugin-swc --save-dev
Yarn
$ yarn add complugin-swc --dev
pnpm
$ pnpm add complugin-swc --save-dev
Options
- The configuration options of this plug-in are inherited from those of SWC. Please check the configuration options of SWC for details.
interface Options extends SwcOptions {
/**
* A minimatch pattern, or array of patterns,
* which specifies the files in the build the plugin should ignore.
*
* When relying on Swc configuration files you can only exclude additional files with this option,
* you cannot override what you have configured for Swc itself.
*
*/
include?: (string | RegExp)[]
/**
* A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should operate on.
* When relying on Swc configuration files you cannot include files already excluded there.
*/
exclude?: (string | RegExp)[]
/**
* Use SWC to transform your code.
* @default true
*/
enableTransform?: boolean
/**
* Compress your code with SWC
* @default false
*/
minify?: boolean
}
Usage
Vite
// vite.config.ts
import Swc from 'complugin-swc'
export default {
plugins: [
Swc.vite({
/* options */
})
]
}
Rollup
// rollup.config.js
import Swc from 'complugin-swc'
export default {
plugins: [
Swc.rollup({
/* options */
})
]
}
Webpack
// webpack.config.js
const Swc = require('complugin-swc').default
module.exports = {
plugins: [
Swc.webpack({
/* options */
})
]
}
esbuild
// esbuild.config.js
import _esbuild from 'esbuild'
import { proxyEsbuild } from 'complugin'
import Swc from 'complugin-swc'
// Cannot be omitted
const esbuild = proxyEsbuild(_esbuild)
esbuild.build({
plugins: [
Swc.esbuild({
/* options */
})
]
})
Give a ⭐️ if this project helped you!
License
MIT License © 2022 xxXyh1908