Issues with esbuild
See original GitHub issueDuplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
Look at this issue for more reference: https://github.com/mui/material-ui/issues/31140
The essence of it is that esbuild
might not be building MUI dependencies properly so when accessing MUI functions like createTheme
and useEnhancedEffect
give an error in run time. The issue referenced above is more with Remix but since @jacobgad faced the same issue with Vite and that also uses esbuild
, I am more leaned towards this issue is related to esbuild
than Remix or Vite.
Expected behavior 🤔
No Uncaught TypeError: createTheme_default is not a function
or Uncaught TypeError: useEnhancedEffect_default is not a function
run-time errors
Steps to reproduce 🕹
Steps:
- fork this codesandbox and use
useEnhancedEffect
from MUI instead of the custom one - go to
ErrorBoundary
orCatchBoundary
by clicking the link - refreshing the page (the site in codesandbox not the codesandbox itself)
- open the console t see the error
Context 🔦
Was just trying to figure out how to have a complete theme change experience with MUI and Remix but found this problem with esbuild
(likely)
Your environment 🌎
`npx @mui/envinfo`
System:
OS: Linux 5.4 Debian GNU/Linux 10 (buster) 10 (buster)
Binaries:
Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v14.18.1/bin/yarn
npm: 6.14.15 - ~/.nvm/versions/node/v14.18.1/bin/npm
Browsers:
Chrome: Not Found
Firefox: Not Found
npmPackages:
@emotion/react: latest => 11.8.2
@emotion/styled: latest => 11.8.1
@mui/base: 5.0.0-alpha.72
@mui/icons-material: latest => 5.5.1
@mui/material: latest => 5.5.1
@mui/private-theming: 5.4.4
@mui/styled-engine: 5.4.4
@mui/system: 5.5.1
@mui/types: 7.1.3
@mui/utils: 5.4.4
@types/react: latest => 17.0.40
react: latest => 17.0.2
react-dom: latest => 17.0.2
typescript: latest => 4.6.2
Issue Analytics
- State:
- Created 2 years ago
- Reactions:21
- Comments:27 (3 by maintainers)
Top GitHub Comments
experice same issue…
still can find the root cause of the problem…
iam using vite v2.9.9 & “@mui/material”: “^5.8.0”,
my temp fix, make error in vite config, undo, recompile
my problem somewhere near :
import Box from "@mui/material/Box";
i changed into :import {Box}from "@mui/material";
thanks @geneshairzan your temp fix worked for me
my error was
Box.js:5 undefined is not a function
seems to be fixed by changing
import Box from "@mui/material/Box";
this lineto this
import {Box} from "@mui/material";