Skip to content

Commit fb1f0a4

Browse files
authored
docs: add usage guide for Rspack (#28)
1 parent b782d92 commit fb1f0a4

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Install:
2020
npm add @rsbuild/plugin-check-syntax -D
2121
```
2222

23-
Add plugin to your `rsbuild.config.ts`:
23+
Add plugin to your Rsbuild config:
2424

2525
```ts
2626
// rsbuild.config.ts
@@ -31,6 +31,26 @@ export default {
3131
};
3232
```
3333

34+
This plugin is compatible with both Rsbuild and Rspack. If you are using Rspack instead of Rsbuild, you can import the `CheckSyntaxRspackPlugin` from the package:
35+
36+
```ts
37+
// rspack.config.mjs
38+
import { defineConfig } from "@rspack/cli";
39+
import { CheckSyntaxRspackPlugin } from "@rsbuild/plugin-check-syntax";
40+
41+
export default defineConfig({
42+
mode: process.env.NODE_ENV === "production" ? "production" : "development",
43+
devtool: "source-map",
44+
plugins: [
45+
new CheckSyntaxRspackPlugin({
46+
ecmaVersion: 2015,
47+
}),
48+
],
49+
});
50+
```
51+
52+
> When using `CheckSyntaxRspackPlugin`, it will not read the browserslist configuration from the project, so you need to specify the [ecmaVersion](#ecmaVersion) or [targets](#targets) option.
53+
3454
## Enable Detection
3555

3656
After registering the Check Syntax plugin, Rsbuild will perform syntax checking after production builds.

0 commit comments

Comments
 (0)