Open clickspider opened 4 months ago
tagging @Janpot as it he was the last who touched this file, but might not be related to his changes - https://github.com/mui/material-ui/pull/40772
@zannager thanks for helping out! small update -> it seems like @Janpot just pushed a Prettier update on that file but originally the logic was written here - https://github.com/mui/material-ui/pull/13426 by @TrySound , sorry for the confusion earlier.
Small update: to workaround this I have split my libs to not have to build NextJS middleware in the same lib as my MUI code. However, this issue still needs to be addressed.
Steps to reproduce
Link to live example: (nextjs error repo)
Steps:
npm i
npx nx build nx-nextjs-monorepo
Current behavior
Getting an error:
Also saw this error when using
mui
pervious version5.15.14
:Expected behavior
That error will not appear, and fix the code that causes the issue.
Context
When trying to setup a NX monorepo with NextJS 14 (App Router), I have exported from my libs folder some middleware(s) and then when running the build command I get this error (see above).
After I further investigated I saw that it has something to deal with this file: https://github.com/mui/material-ui/blame/next/packages/mui-utils/src/ponyfillGlobal/ponyfillGlobal.ts
Whenever I changed it locally in my
node_modules
to just returnthis
instead ofFunction('return this')
the build started to work fine again. I am not sure on the cause of this.Your environment
``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```npx @mui/envinfo
Search keywords: ponyfillglobal