oxc-webpack-loader
v1.0.0
- Types
- ESM
- CJS
- License
- MIT
- Deps
- 0
- Install Size
- 7.6 kB/-
- Vulns
- 0
- Published
$
npm install oxc-webpack-loader$
pnpm add oxc-webpack-loader$
yarn add oxc-webpack-loader$
bun add oxc-webpack-loader$
deno add npm:oxc-webpack-loader$
vlt install oxc-webpack-loaderoxc-loader
Webpack loader for oxc-transform. A drop-in replacement for swc-loader and babel-loader that uses Oxc for fast JavaScript and TypeScript transformation.
Install
npm install -D oxc-webpack-loader oxc-transform
Usage
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.[jt]sx?$/,
exclude: /node_modules/,
use: {
loader: "oxc-webpack-loader",
options: {
// oxc-transform options
// https://oxc.rs/docs/guide/usage/transformer.html#features
},
},
},
],
},
};
JSX
{
loader: "oxc-webpack-loader",
options: {
jsx: {
runtime: "automatic", // or "classic"
},
},
}
TypeScript
TypeScript is supported out of the box. No additional configuration is needed - just include .ts and .tsx in the test pattern.
Target
{
loader: "oxc-webpack-loader",
options: {
target: "es2015",
},
}
Source Maps
{
loader: "oxc-webpack-loader",
options: {
sourcemap: true,
},
}
Source maps are also automatically enabled when webpack's devtool option is set.
Sync Mode
{
loader: "oxc-webpack-loader",
options: {
sync: true,
},
}
Options
All oxc-transform TransformOptions are supported, plus:
| Option | Type | Default | Description |
|---|---|---|---|
sync |
boolean |
false |
Use transformSync instead of transform. The async transform spawns a thread per call, which can be slower due to overhead. Sync mode runs on the main thread and may be faster for small files. |
License
Oxc is free and open-source software licensed under the MIT License.