You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're trying to add the exports field to the package.json of MUI core libraries (PR | Docs).
This app is using the MUI libraries from the PR 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
Full error
⨯ 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
DiegoAndai
changed the title
Dependencies with exports field break on pages router with esmExternals: false
Dependencies with exports field break on pages router with esmExternals: false | 'loose'Apr 25, 2024
DiegoAndai
changed the title
Dependencies with exports field break on pages router with esmExternals: false | 'loose'
Dependencies with exports field break on pages router with esmExternals: falseApr 25, 2024
Link to the code that reproduces this issue
https://github.com/DiegoAndai/esm-test-13-nextjs-pages-mui-exports-ts
To Reproduce
npm install
npm run dev
http://localhost:3000
in the browserDescription
We're trying to add the
exports
field to thepackage.json
of MUI core libraries (PR | Docs).This app is using the MUI libraries from the PR 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:Full error
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
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
14.2.3
,13.5.1
, and13.4.0
.The text was updated successfully, but these errors were encountered: