Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swc-project/swc-loader
Moved to https://github.com/swc-project/pkgs
https://github.com/swc-project/swc-loader
swc webpack-loader
Last synced: 3 months ago
JSON representation
Moved to https://github.com/swc-project/pkgs
- Host: GitHub
- URL: https://github.com/swc-project/swc-loader
- Owner: swc-project
- License: mit
- Archived: true
- Created: 2018-12-22T08:33:37.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-14T23:54:08.000Z (almost 2 years ago)
- Last Synced: 2024-10-29T22:38:01.376Z (3 months ago)
- Topics: swc, webpack-loader
- Language: JavaScript
- Homepage:
- Size: 50.8 KB
- Stars: 394
- Watchers: 6
- Forks: 29
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - swc-project/swc-loader - Moved to https://github.com/swc-project/pkgs (JavaScript)
README
# swc-loader
This package allows transpiling JavaScript files using swc and webpack.
## Installation
```sh
npm i --save-dev @swc/core swc-loader webpack
```## Usage
```js
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
// Use `.swcrc` to configure swc
loader: "swc-loader"
}
}
];
}
```You can pass options to the loader by using the option property.
```js
module: {
rules: [
{
test: /\.ts$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: "swc-loader",
options: {
jsc: {
parser: {
syntax: "typescript"
}
}
}
}
}
];
}
```If you get an error while using `swc-loader`, you can pass `sync: true` to get correct error message.
```js
module: {
rules: [
{
test: /\.ts$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: "swc-loader",
options: {
// This makes swc-loader invoke swc synchronously.
sync: true,
jsc: {
parser: {
syntax: "typescript"
}
}
}
}
}
];
}
```## Configuration Reference
Refer https://swc.rs/docs/configuring-swc