question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with esbuild

See original GitHub issue

Duplicates

  • 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:

  1. fork this codesandbox and use useEnhancedEffect from MUI instead of the custom one
  2. go to ErrorBoundary or CatchBoundary by clicking the link
  3. refreshing the page (the site in codesandbox not the codesandbox itself)
  4. 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:open
  • Created 2 years ago
  • Reactions:21
  • Comments:27 (3 by maintainers)

github_iconTop GitHub Comments

18reactions
geneshairzancommented, Jun 13, 2022

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";

9reactions
akshayitzmecommented, Jun 18, 2022

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 line

to this import {Box} from "@mui/material";

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · evanw/esbuild - GitHub
Issues list ; 0.16.8 introduced breaking resolution change for plugins. #2762 opened last week ; v0.16.6 - failed to start esbuild if any...
Read more >
FAQ - ESBuild
This is a collection of common questions about esbuild. You can also ask questions on the GitHub issue tracker. Why is esbuild fast?...
Read more >
How to fix problems with esbuild in Yarn - DEV Community ‍ ‍
Never mind, I found the solution. The build must be started with yarn node esbuild.config.js so that dependencies are resolved using .pnp.cjs if ......
Read more >
esbuild - npm Package Health Analysis - Snyk
The npm package esbuild was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as...
Read more >
hyrious/esbuild-plugin-commonjs - Issues - Socket.dev
Bundle commonjs externals in es module in esbuild. Version: 0.2.1 was published by hyrious. Start using Socket to analyze @hyrious/esbuild-plugin-commonjs ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found