Webpack loader for oxc-transform. A drop-in replacement for swc-loader and babel-loader that uses Oxc for fast JavaScript and TypeScript transformation.
npm install -D oxc-webpack-loader oxc-transformwebpack.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
},
},
},
],
},
};{
loader: "oxc-webpack-loader",
options: {
jsx: {
runtime: "automatic", // or "classic"
},
},
}TypeScript is supported out of the box. No additional configuration is needed - just include .ts and .tsx in the test pattern.
{
loader: "oxc-webpack-loader",
options: {
target: "es2015",
},
}{
loader: "oxc-webpack-loader",
options: {
sourcemap: true,
},
}Source maps are also automatically enabled when webpack's devtool option is set.
{
loader: "oxc-webpack-loader",
options: {
sync: true,
},
}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. |
Oxc is free and open-source software licensed under the MIT License.