Git Product home page Git Product logo

Comments (5)

swernerx avatar swernerx commented on June 12, 2024

When adding a debug console.log to the bundles of @emotion/react it seems that the ESM bundle is loaded two times:

@emotion_react.js?v=f88aff20:340 Emotion Browser-ESM
@mui_material.js?v=e7f1b82a:1653 Emotion Browser-ESM
@mui_material.js?v=e7f1b82a:1655 You are loading @emotion/react when it is already loaded. Running multiple instances may cause problems. This can happen if multiple versions are used, or if multiple builds of the same version are used.
  1. standalone as it is used by the actual application
  2. pre-bundled as it is used by a dependency of @mui/material

from vite-plugin-react.

swernerx avatar swernerx commented on June 12, 2024

The issue seems to be related to dev-mode only. In the production build + vite preview everything works fine.

from vite-plugin-react.

hengwangsay avatar hengwangsay commented on June 12, 2024

same issue for me

from vite-plugin-react.

ArnaudBarre avatar ArnaudBarre commented on June 12, 2024

This bug still happen with the latest version of Vite. @patak-dev I think this bug should go back to Vite core repo, it seems to be an issue with how pre-bundling works.

Another workaround I found is to make the main app explicitly depend on @mui/material and add this to the config:
include: ['@mui/material'],

from vite-plugin-react.

ArnaudBarre avatar ArnaudBarre commented on June 12, 2024

Hi! Bumping all dependencies to latest and restating the lockfile from scratch solve the issue. The bug is really sensitive to the fact that you can have a mismatch of emotion versions between the uikit and your app. Maybe having only one version in the workspace could make this more stable.

If you still find yourself having issues with this, I suggest you open create a new issue into the core repo

from vite-plugin-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.