> **Version 9** — **React** / **TypeScript**
> Also available:
- `?language=js` for JavaScript
- `?codeOnly=true` for code snippets only
- other versions: Version 10.3 (latest) (`/docs/api/main-config/main-config-webpack-final.md`), Version 8 (`/docs/8/api/main-config/main-config-webpack-final.md`)

# webpackFinal

Parent: [main.js|ts configuration](./main-config.mdx)

Type: `async (config: Config, options: WebpackOptions) => Config`

Customize Storybook's Webpack setup when using the [webpack builder](../../builders/webpack.mdx).

```ts
// .storybook/main.ts
// Replace your-framework with the framework you are using, e.g. react-webpack5, nextjs, angular, etc.

const config: StorybookConfig = {
  framework: '@storybook/your-framework',
  stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
  webpackFinal: async (config, { configType }) => {
    if (configType === 'DEVELOPMENT') {
      // Modify config for development
    }
    if (configType === 'PRODUCTION') {
      // Modify config for production
    }
    return config;
  },
};

export default config;
```

## `Options`

Type: `{ configType?: 'DEVELOPMENT' | 'PRODUCTION' }`

There are other options that are difficult to document here. Please introspect the type definition for more information.