Repository: storybook
Issue: [Bug]: Cannot build static site after upgrade
Labels: bug,builder-webpack5,windows

### Describe the bug

```
c:\Temp18\ahab\node_modules\webpack\lib\util\hash\wasm-hash.js:108
                const length = data.length;
                                    ^


TypeError: Cannot read properties of undefined (reading 'length')
    at WasmHash._updateWithBuffer (C:\Temp18\ahab\node_modules\webpack\lib\util\hash\wasm-hash.js:98:25)
    at WasmHash.update (C:\Temp18\ahab\node_modules\webpack\lib\util\hash\wasm-hash.js:42:10)
    at BatchedHash.update (C:\Temp18\ahab\node_modules\webpack\lib\util\hash\BatchedHash.js:36:17)
    at C:\Temp18\ahab\node_modules\webpack\lib\FileSystemInfo.js:3112:16
    at processQueue (C:\Temp18\ahab\node_modules\webpack\lib\util\processAsyncTree.js:40:7)
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
```

### To Reproduce

We upgraded Nx from 15.8.6 to 16.3.2. Webpack was upgraded from 5.75 to 5.86

rootMain
```
import type { StorybookConfig } from "@storybook/react-webpack5";

export const rootMain: StorybookConfig = {
  addons: [],
  core: {
    builder: "@storybook/builder-webpack5",
    disableTelemetry: true
  },
  framework: {
    name: "@storybook/react-webpack5",
    options: { fastRefresh: true, strictMode: true }
  },
  stories: [],
  docs: {
    autodocs: true
  },
  webpackFinal: async (config: any) => {
    // Make whatever fine-grained changes you need that should apply to all storybook configs

    // https://github.com/storybookjs/storybook/issues/6188#issuecomment-1228596862
    if (config.module?.rules)
      config.module.rules = [
        ...config.module.rules.map((rule: any) => {
          // Silence the Storybook loaders for SVG files
          if (/svg/.test(rule.test))
            return {
              ...rule,
              exclude: /\.svg$/i
            };
          return rule;
        }),
        // Add your custom SVG loader
        {
          test: /\.svg$/i,
          use: ["@svgr/webpack", "url-loader"]
        }
      ];

    // Return the altered config
    return config;
  }
};

// To customize your webpack configuration you can use the webpackFinal field.
// Check https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config
// and https://nx.dev/packages/storybook/documents/custom-builder-configs
```

Project (that failed) main.ts
```
import type { StorybookConfig } from "@storybook/react-webpack5";

import { rootMain } from "../../../.storybook/main";

const config: StorybookConfig = {
  ...rootMain,
  addons: [
    ...(rootMain.addons || []),
    "@storybook/addon-essentials",
    "@nx/react/plugins/storybook",
    "@storybook/addon-mdx-gfm"
  ],
  stories: [
    ...rootMain.stories,
  ],
  staticDirs: ["../src/lib/solutions"]
};
export default config;

```


### System

```shell
Environment Info:

  System:
    OS: Windows 10 10.0.22000
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  Binaries:
    Node: 18.15.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (114.0.1823.43)
  npmPackages:
    @storybook/addon-essentials: 7.0.20 => 7.0.20
    @storybook/addon-interactions: ^7.0.20 => 7.0.20
    @storybook/addon-jest: ^7.0.20 => 7.0.20
    @storybook/addon-links: ^7.0.20 => 7.0.20
    @storybook/addon-mdx-gfm: ^7.0.20 => 7.0.20
    @storybook/addons: ^7.0.20 => 7.0.20
    @storybook/core-common: ^7.0.20 => 7.0.20
    @storybook/core-server: 7.0.20 => 7.0.20
    @storybook/jest: ^0.1.0 => 0.1.0
    @storybook/react: 7.0.20 => 7.0.20
    @storybook/react-webpack5: ^7.0.20 => 7.0.20
    @storybook/testing-library: ^0.1.0 => 0.1.0
    @storybook/testing-react: ^2.0.0 => 2.0.1
    @storybook/theming: ^7.0.20 => 7.0.20
```


### Additional context

_No response_