Webpack loader for the SWC compiler (Rust-based transpiler for JS/TS). Current stable version 0.2.7. Released as part of the swc project (monorepo under @swc). Key differentiators: integrates SWC into Webpack build pipeline for fast transpilation; supports both JavaScript and TypeScript via swc configuration; can be run synchronously or asynchronously. Alternatives include babel-loader, ts-loader.
npm install swc-loaderVerified import paths — ran on the pinned version, not inferred.
Basic webpack configuration to transpile JavaScript files using swc-loader
Add sync: true to loader options.
Upgrade @swc/core to ^1.2.147.
Refer to swc.rs/docs/configuring-swc for valid options.
Either provide .swcrc or pass all config via loader options.
Add jsc: { parser: { syntax: 'typescript' } } to loader options.npm install --save-dev @swc/core
Upgrade webpack to >=2
Set sync: true in loader options