Skip to content

Commit 78c3a24

Browse files
committed
docs: use mjs configuration file
1 parent ad83c45 commit 78c3a24

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ pnpm add -D ts-checker-rspack-plugin
4242
The minimal Rspack config with [builtin:swc-loader](https://rspack.dev/guide/features/builtin-swc-loader).
4343

4444
```js
45-
// rspack.config.js
46-
const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');
45+
// rspack.config.mjs
46+
import { TsCheckerRspackPlugin } from 'ts-checker-rspack-plugin';
4747

48-
module.exports = {
49-
context: __dirname, // to automatically find tsconfig.json
48+
export default {
5049
entry: './src/index.ts',
5150
resolve: {
5251
extensions: ['.ts', '.tsx', '.js'],
@@ -67,12 +66,17 @@ module.exports = {
6766
],
6867
},
6968
plugins: [new TsCheckerRspackPlugin()],
70-
watchOptions: {
71-
// for some systems, watching many files can result in a lot of CPU or memory usage
72-
// https://rspack.dev/config/watch#watchoptionsignored
73-
// don't use this pattern, if you have a monorepo with linked packages
74-
ignored: /node_modules/,
75-
},
69+
};
70+
```
71+
72+
If you are using CommonJS:
73+
74+
```js
75+
// rspack.config.js
76+
const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');
77+
78+
module.exports = {
79+
plugins: [new TsCheckerRspackPlugin()],
7680
};
7781
```
7882

@@ -94,7 +98,7 @@ Rspack's modules resolution**. It means that you have to setup `tsconfig.json` c
9498
| `issue` | `object` | `{}` | See [Issues options](#issues-options). |
9599
| `formatter` | `string` or `object` or `function` | `codeframe` | Available formatters are `basic`, `codeframe` and a custom `function`. To [configure](https://babeljs.io/docs/en/babel-code-frame#options) `codeframe` formatter, pass: `{ type: 'codeframe', options: { <coderame options> } }`. To use absolute file path, pass: `{ type: 'codeframe', pathType: 'absolute' }`. |
96100
| `logger` | `{ log: function, error: function }` or `webpack-infrastructure` | `console` | Console-like object to print issues in `async` mode. |
97-
| `devServer` | `boolean` | `true` | If set to `false`, errors will not be reported to Dev Server and displayed in the error overlay. |
101+
| `devServer` | `boolean` | `true` | If set to `false`, errors will not be reported to Dev Server and displayed in the error overlay. |
98102

99103
### TypeScript options
100104

0 commit comments

Comments
 (0)