Skip to content
Merged

Change2 #7932

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/content/concepts/targets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ To set the `target` property, you set the target value in your webpack config:
**webpack.config.js**

```javascript
module.exports = {
export default {
target: "node",
};
```
Expand All @@ -39,7 +39,11 @@ Although webpack does **not** support multiple strings being passed into the `ta
**webpack.config.js**

```javascript
const path = require("node:path");
import path from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const serverConfig = {
target: "node",
Expand All @@ -59,7 +63,7 @@ const clientConfig = {
// …
};

module.exports = [serverConfig, clientConfig];
export default [serverConfig, clientConfig];
Comment thread
ItsAbir005 marked this conversation as resolved.
```

The example above will create a `lib.js` and `lib.node.js` file in your `dist` folder.
Expand Down
6 changes: 3 additions & 3 deletions src/content/concepts/under-the-hood.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ When you describe an entry point - under the hood, you create a chunk group with
**./webpack.config.js**

```js
module.exports = {
export default {
entry: "./index.js",
};
```
Expand All @@ -52,7 +52,7 @@ Another example:
**./webpack.config.js**

```js
module.exports = {
export default {
entry: {
home: "./home.js",
about: "./about.js",
Expand All @@ -77,7 +77,7 @@ Each chunk has a corresponding **asset**. The assets are the output files - the
**webpack.config.js**

```js
module.exports = {
export default {
entry: "./src/index.jsx",
};
```
Expand Down
Loading