-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with esbuild #31835
Comments
Encountered a similar issue using Vite. This (sometimes) resolves it temporarily for me:
There were times where I tried the steps above and it simply would throw the same error at step 3. |
Experiencing this as well with vite |
@arpitdalal did you try to remove icons from page: #32891 ? |
any solution so far? |
@arpitdalal I'm trying to reproduce the error using the codesandbox you provided, but I'm unable to. Perhaps a more recent version of dependencies could solve the problem. Could you please verify if that's the case? I was also trying to investigate the issue using plain esbuild, but I also wasn't able to make it fail. |
in my theme.ts, if I use below, I can reproduce the issue: createTheme_default is not a function
But if I use this line below, it fixes it:
remix / material, all npm "latest" |
I was getting the If your project was set up using the Remix MUI Example, then the fix for me was to add the import * as React from "react";
import Container from "@mui/material/Container";
import Box from "@mui/material/Box";
import CssBaseline from "@mui/material/CssBaseline";
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<Container maxWidth="sm">
<Box sx={{ my: 4 }}>
<CssBaseline />
{children}
</Box>
</Container>
);
} although, still getting Final Update: |
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, my problem somewhere near : |
thanks @geneshairzan your temp fix worked for me my error was seems to be fixed by changing to this |
worked! thanks |
@michaldudak I haven't tried reproducing this error by using just esbuild because I do not have the knowledge to create a raw project with esbuild. But I can definitely reproduce this with Remix's esbuild config. Here's a sandbox with the latest dependencies which uses Steps to reproduce:open the site > click on any link > open dev console > hard refresh with ctrl + shift + R (w/e it is for macos). You should see the page breaking with the first error other than react 18 warning will be Temporary workaround:in the codesandbox comment the line 19 and uncomment line 24 which uses the custom I can confirm that this is related to the Steps to reproduce:same steps to reproduce as above Temporary workaround:open the codesnadbox > comment lines 3, 4, and 42 > uncomment line 43 > this way app is not using I want to throw some light on the fact that this only happens when the error/catch boundary is hard-refreshed, meaning SSR'ed, if client-side navigated to these pages, it doesn't break the page. |
in my environment // Failure
import Box from '@mui/material/Box';
import CssBaseline from '@mui/material/CssBaseline';
// OK
import CssBaseline from '@mui/material/CssBaseline';
import Box from '@mui/material/Box';
// Also OK
import { Box } from '@mui/material';
import CssBaseline from '@mui/material/CssBaseline'; |
Today I encountered this issue after installing My workaround was to use Icon Fonts. Hopefully the root issue will be fixed soon. |
The same here, thanks for sharing @williamrjribeiro |
I had this issue and could not solve it with the above solutions. Uninstalling and re-installing then rebuild worked for me:
|
thanks to @geneshairzan, its kind of absurd, but causing error in vite.config.js and restarting the server after the crash actually solves my problem, I'm not sure why, i kept on getting - |
All import should work if they are imported from top level: '@mui/material' for e.g. |
For those who are having the problem with Vite, I solved it the same way (upgrading the imports to a higher level). If the problem continues, just delete the "node_modules" folder and then reinstall all dependencies. |
Resolved it by changing |
Also builds the Grid UI using `esbuild`. The weird imports in the Grid UI are due to an issue with the way that `esbuild` interacts with `@mui/material-icons`: mui/material-ui#31835 (comment)
Also builds the Grid UI using `esbuild`. The weird imports in the Grid UI are due to an issue with the way that `esbuild` interacts with `@mui/material-icons`: mui/material-ui#31835 (comment)
Also builds the Grid UI using `esbuild`. The weird imports in the Grid UI are due to an issue with the way that `esbuild` interacts with `@mui/material-icons`: mui/material-ui#31835 (comment)
Also builds the Grid UI using `esbuild`. The weird imports in the Grid UI are due to an issue with the way that `esbuild` interacts with `@mui/material-icons`: mui/material-ui#31835 (comment)
Also builds the Grid UI using `esbuild`. The weird imports in the Grid UI are due to an issue with the way that `esbuild` interacts with `@mui/material-icons`: mui/material-ui#31835 (comment)
Also builds the Grid UI using `esbuild`. The weird imports in the Grid UI are due to an issue with the way that `esbuild` interacts with `@mui/material-icons`: mui/material-ui#31835 (comment)
Also builds the Grid UI using `esbuild`. The weird imports in the Grid UI are due to an issue with the way that `esbuild` interacts with `@mui/material-icons`: mui/material-ui#31835 (comment)
I met this error when I was working with a Vite+React+TS application.
Here, the both two lines are needed |
Also builds the Grid UI using `esbuild`. The weird imports in the Grid UI are due to an issue with the way that `esbuild` interacts with `@mui/material-icons`: mui/material-ui#31835 (comment)
Also builds the Grid UI using `esbuild`. The weird imports in the Grid UI are due to an issue with the way that `esbuild` interacts with `@mui/material-icons`: mui/material-ui#31835 (comment)
Also builds the Grid UI using `esbuild`. The weird imports in the Grid UI are due to an issue with the way that `esbuild` interacts with `@mui/material-icons`: mui/material-ui#31835 (comment)
This seems to be caused by node not getting the correct introduction when executing esm. You need to add type:module or exports:{import: "xx.mjs"} to each package.json of mui. If there is no these, the module will be introduced according to commonjs to load the entry file of the main field. |
followed a few things in here mui/material-ui#31835
Adding |
I just got this error again after I removed all the barrel files in a project. This time around the fix was to change import Box from '@mui/material/Box'; to import { Box } from '@mui/material'; Is this something to do with treeshaking? |
If you are using vite, just go and delete node_modules/@.vite/deps and run npm i. It fix my problem every time. It's some cache problem |
i love you men you have no idea i have been trying to fix this stupid issue for almost 6 hours |
no need of other only do the
|
Even though it may not necessarily look like it, we have reason to believe that the root cause of this issue actually lies in If you still run into issues after upgrading to >6.1.0, please open a new ticket, this will allow us to separate whatever problem is left from the rest of this ticket. Thank you for your patience. |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note We value your feedback @arpitdalal! How was your experience with our support team? |
* Made sure that all materials are imported from the top level * See issue mui/material-ui#31835 * Small cosmetic changes for the other mui/material imports
* Migrate from webpack to vite * Remove unnecessary dev dependencies * Resolve issue for Buffer not being defined * Change alias for source folder * Fixed issue for createTheme_default being undefined * Made sure that all materials are imported from the top level * See issue mui/material-ui#31835 * Small cosmetic changes for the other mui/material imports * Update mui to v6.1.5 * Remove deprecated ReactDOM.render
For me anything above didn't fixed the issue, its a vite bug which i have temporarily fixed by :
|
* Migrate from webpack to vite * Remove unnecessary dev dependencies * Resolve issue for Buffer not being defined * Change alias for source folder * Fixed issue for createTheme_default being undefined * Made sure that all materials are imported from the top level * See issue mui/material-ui#31835 * Small cosmetic changes for the other mui/material imports * Update mui to v6.1.5 * Remove deprecated ReactDOM.render
Current behavior 😯
Look at this issue for more reference: #31140
The essence of it is that
esbuild
might not be building MUI dependencies properly so when accessing MUI functions likecreateTheme
anduseEnhancedEffect
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 usesesbuild
, I am more leaned towards this issue is related toesbuild
than Remix or Vite.Expected behavior 🤔
No
Uncaught TypeError: createTheme_default is not a function
orUncaught TypeError: useEnhancedEffect_default is not a function
run-time errorsSteps to reproduce 🕹
Steps:
useEnhancedEffect
from MUI instead of the custom oneErrorBoundary
orCatchBoundary
by clicking the linkContext 🔦
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`
The text was updated successfully, but these errors were encountered: