basarat / basarat/typescript-book

Add code splitting example / section

Open
#365 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
21.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

tsconfig needs module specification:

```
"moduleResolution": "node",
"module": "esnext",
```

webpack.config.js needs chunkFilename specificaiton:

```
output: {
path: path.join(__dirname, "dist"),
filename: "[name].bundle.js",
chunkFilename: "[name].chunk.js"
},
```

# More
You can also specify chunk names if you want to but I wouldn't:

```
await import(/* webpackChunkName: "foo" */ "./foo");
```

Contributor guide

Open the contributing guide

Research direction

Locate the relevant documentation section along with tsconfig and webpack.config.js, then review how examples are organized. Add a code-splitting example covering the module settings, chunkFilename, and optional chunk naming shown in the issue; it is done when the section clearly explains and demonstrates these settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, webpack
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.