<commit_before># Configuring webpack

Styleguidist uses [webpack](https://webpack.js.org/) under the hood and it needs to know how to load your project’s files.

_Webpack is required to run Styleguidist but your project doesn’t have to use it._

> **Note:** See [cookbook](Cookbook.md) for more examples.

<!-- To update run: npx markdown-toc --maxdepth 2 -i docs/Webpack.md -->

<!-- toc -->

- [Reusing your project’s webpack config](#reusing-your-projects-webpack-config)
- [Custom webpack config](#custom-webpack-config)
- [Create React App](#create-react-app)
- [Create React App, TypeScript](#create-react-app-typescript)
- [Non-webpack projects](#non-webpack-projects)
- [When nothing else works](#when-nothing-else-works)

<!-- tocstop -->

## Reusing your project’s webpack config

By default Styleguidist will try to find `webpack.config.js` in your project’s root directory and use it.

If your webpack config is located somewhere else, you need to load it manually:

```javascript
module.exports = {
  webpackConfig: require('./configs/webpack.js')
}
```<commit_msg>Docs: Fix link to "Create React App with TypeScript" section (#1154)<commit_after># Configuring webpack

Styleguidist uses [webpack](https://webpack.js.org/) under the hood and it needs to know how to load your project’s files.

_Webpack is required to run Styleguidist but your project doesn’t have to use it._

> **Note:** See [cookbook](Cookbook.md) for more examples.

<!-- To update run: npx markdown-toc --maxdepth 2 -i docs/Webpack.md -->

<!-- toc -->

- [Reusing your project’s webpack config](#reusing-your-projects-webpack-config)
- [Custom webpack config](#custom-webpack-config)
- [Create React App](#create-react-app)
- [Create React App with TypeScript](#create-react-app-with-typescript)
- [Non-webpack projects](#non-webpack-projects)
- [When nothing else works](#when-nothing-else-works)

<!-- tocstop -->

## Reusing your project’s webpack config

By default Styleguidist will try to find `webpack.config.js` in your project’s root directory and use it.

If your webpack config is located somewhere else, you need to load it manually:

```javascript
module.exports = {
  webpackConfig: require('./configs/webpack.js')
}
```
{'fraction_non_alphanumeric': 0.13153153153153152, 'fraction_numerical': 0.002702702702702703, 'mean_word_length': 4.40389294403893, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7341981', 'n_tokens_mistral': 688, 'n_tokens_neox': 661, 'n_words': 233}