Skip to content

Commit 2a018b4

Browse files
committed
docs(guides): add examples for mjs and cjs configs
1 parent ffc7577 commit 2a018b4

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/content/guides/getting-started.mdx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ As of version 4, webpack doesn't require any configuration, but most projects wi
244244
|- index.js
245245
```
246246

247-
**webpack.config.mjs**
247+
<CodeGroup>
248+
249+
<CodeBlock label="webpack.config.mjs" active>
248250

249251
```javascript
250252
import path from 'path';
@@ -259,7 +261,22 @@ export default {
259261
path: path.resolve(__dirname, 'dist'),
260262
},
261263
};
262-
```
264+
</CodeBlock>
265+
266+
<CodeBlock label="webpack.config.cjs / .js">
267+
const path = require('path');
268+
269+
module.exports = {
270+
entry: './src/index.js',
271+
output: {
272+
filename: 'main.js',
273+
path: path.resolve(__dirname, 'dist'),
274+
},
275+
};
276+
</CodeBlock>
277+
278+
</CodeGroup>
279+
263280

264281
Now, let's run the build again but instead using our new configuration file:
265282

0 commit comments

Comments
 (0)