Repository: next.js
Issue: Dependencies with `exports` field break on pages router with `esmExternals: false`
Labels: bug,Pages Router,linear: next

### Link to the code that reproduces this issue

https://github.com/DiegoAndai/esm-test-13-nextjs-pages-mui-exports-ts

### To Reproduce

1. Clone https://github.com/DiegoAndai/esm-test-13-nextjs-pages-mui-exports-ts
2. Run `npm install`
3. Run `npm run dev`
4. Open `http://localhost:3000` in the browser
5. You should see the error

### Description

We're trying to add the `exports` field to the `package.json` of MUI core libraries ([PR](https://github.com/mui/material-ui/pull/41596) | [Docs](https://deploy-preview-41596--material-ui.netlify.app/material-ui/migration/migration-v5/#added-exports-field-to-package-json)).
This app is using the MUI libraries from the [PR](https://github.com/mui/material-ui/pull/41596) build (e.g., https://pkg.csb.dev/mui/material-ui/commit/fb7a4ff2/@mui/material).
When testing the libraries on a Next.js app with pages router and `esmExternals: false`, we get the following error:

```
⨯ TypeError: _mui_utils_deepmerge__WEBPACK_IMPORTED_MODULE_3__ is not a function
```

<details>
<summary>Full error</summary>
  
```
 ⨯ TypeError: _mui_utils_deepmerge__WEBPACK_IMPORTED_MODULE_3__ is not a function
    at createPalette (webpack-internal:///./node_modules/@mui/material/styles/createPalette.mjs:266:27)
    at createTheme (webpack-internal:///./node_modules/@mui/material/styles/createTheme.mjs:47:83)
    at eval (webpack-internal:///./node_modules/@mui/material/styles/defaultTheme.mjs:7:82)
    at ./node_modules/@mui/material/styles/defaultTheme.mjs (/Users/diegoandai/MUI/experiments/esm-test-13-nextjs-pages-mui-exports-ts/.next/server/vendor-chunks/@mui.js:260:1)
    at __webpack_require__ (/Users/diegoandai/MUI/experiments/esm-test-13-nextjs-pages-mui-exports-ts/.next/server/webpack-runtime.js:33:42)
    at eval (webpack-internal:///./node_modules/@mui/material/styles/styled.mjs:8:75)
    at ./node_modules/@mui/material/styles/styled.mjs (/Users/diegoandai/MUI/experiments/esm-test-13-nextjs-pages-mui-exports-ts/.next/server/vendor-chunks/@mui.js:310:1)
    at __webpack_require__ (/Users/diegoandai/MUI/experiments/esm-test-13-nextjs-pages-mui-exports-ts/.next/server/webpack-runtime.js:33:42)
    at eval (webpack-internal:///./node_modules/@mui/material/Button/Button.mjs:13:77)
    at ./node_modules/@mui/material/Button/Button.mjs (/Users/diegoandai/MUI/experiments/esm-test-13-nextjs-pages-mui-exports-ts/.next/server/vendor-chunks/@mui.js:20:1)
    at __webpack_require__ (/Users/diegoandai/MUI/experiments/esm-test-13-nextjs-pages-mui-exports-ts/.next/server/webpack-runtime.js:33:42)
    at eval (webpack-internal:///./node_modules/@mui/material/Button/index.mjs:6:69)
    at ./node_modules/@mui/material/Button/index.mjs (/Users/diegoandai/MUI/experiments/esm-test-13-nextjs-pages-mui-exports-ts/.next/server/vendor-chunks/@mui.js:40:1)
    at __webpack_require__ (/Users/diegoandai/MUI/experiments/esm-test-13-nextjs-pages-mui-exports-ts/.next/server/webpack-runtime.js:33:42)
    at __barrel_optimize__?names=Button!=!./node_modules/@mui/material/index.mjs (/Users/diegoandai/MUI/experiments/esm-test-13-nextjs-pages-mui-exports-ts/.next/server/pages/index.js:26:75) {
  page: '/'
}
 GET / 500 in 128ms
```

</details>

This seems related to default import/export interop between esm and cjs: https://www.typescriptlang.org/docs/handbook/modules/appendices/esm-cjs-interop.html

The expected is for the app to run without erroring.

### Provide environment information

```bash
Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:22 PDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64
  Available memory (MB): 16384
  Available CPU cores: 16
Binaries:
  Node: 18.19.0
  npm: 10.4.0
  Yarn: 1.22.21
  pnpm: 8.14.1
Relevant Packages:
  next: 14.2.3 // Latest available version is detected (14.2.3).
  eslint-config-next: 14.2.3
  react: 18.3.0
  react-dom: 18.3.0
  typescript: 5.4.5
Next.js Config:
  output: N/A
```


### Which area(s) are affected? (Select all that apply)

Pages Router

### Which stage(s) are affected? (Select all that apply)

next dev (local)

### Additional context

- I've tested with Next.js `14.2.3`, `13.5.1`, and `13.4.0`.
- I tried to create a minimal repro, but I couldn't figure it out. I'm sorry about this.