Skip to content

Commit 2421d48

Browse files
authored
docs: update rspack config examples to use mjs (#48)
1 parent 956960f commit 2421d48

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ $ rspack serve -c ./your.config.js
7373
While starting the development server, you can specify the configuration by the `devServer` field of your Rspack config file:
7474

7575
```js
76-
// rspack.config.js
77-
module.exports = {
76+
// rspack.config.mjs
77+
export default {
7878
// ...
7979
devServer: {
8080
// the configuration of the development server
81-
port: 8080
81+
port: 8080,
8282
},
8383
};
8484
```
@@ -92,19 +92,19 @@ While it's recommended to run `@rspack/dev-server` via the CLI, you may also cho
9292
```js
9393
import { RspackDevServer } from "@rspack/dev-server";
9494
import rspack from "@rspack/core";
95-
import rspackConfig from './rspack.config.js';
95+
import rspackConfig from "./rspack.config.mjs";
9696

9797
const compiler = rspack(rspackConfig);
9898
const devServerOptions = {
9999
...rspackConfig.devServer,
100100
// override
101-
port: 8888
101+
port: 8888,
102102
};
103103

104104
const server = new RspackDevServer(devServerOptions, compiler);
105105

106106
server.startCallback(() => {
107-
console.log('Successfully started server on http://localhost:8888');
107+
console.log("Successfully started server on http://localhost:8888");
108108
});
109109
```
110110

0 commit comments

Comments
 (0)