Skip to content
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

CSS variables override not working with Vite #44175

Open
pavankjadda opened this issue Oct 21, 2024 · 0 comments
Open

CSS variables override not working with Vite #44175

pavankjadda opened this issue Oct 21, 2024 · 0 comments
Labels
status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@pavankjadda
Copy link

pavankjadda commented Oct 21, 2024

Steps to reproduce

Link to live example: (required)
StackBlitz: https://stackblitz.com/edit/github-8oqtfo?file=src%2Fmain.tsx
CodeSandbox: https://codesandbox.io/p/github/pavankjadda/mui-css-variables/draft/quizzical-ritchie
Github: https://github.com/pavankjadda/mui-css-variables

Steps:

  1. Clone repo https://github.com/pavankjadda/mui-css-variables
  2. Run the project with npm run dev

Current behavior

Color overriden in theme is not being applied

Expected behavior

Overridden color should apply as expected

Context

  1. I defined reusable Manage button in a react library with below code
  2. In my application I try to use as <ManageButton onClick={() => console.log('Button clicked')}>Library Button</ManageButton>
  3. The application themed via CSS variables and new theme created by overwriting default color palette. But in my app I see default primary color instead of overwritten color

This works in react-scripts+MUI project not with vite+MUI

Your environment

npx @mui/envinfo
 System:
    OS: macOS 14.7
  Binaries:
    Node: 22.10.0 - ~/.nvm/versions/node/v22.10.0/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v22.10.0/bin/npm
    pnpm: 9.12.2 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 129.0.6668.101
    Edge: 130.0.2849.46
    Safari: 18.0.1
  npmPackages:
    @emotion/react: ^11.13.3 => 11.13.3 
    @emotion/styled: ^11.13.0 => 11.13.0 
    @mui/base:  5.0.0-beta.59 
    @mui/core-downloads-tracker:  6.1.4 
    @mui/icons-material: ^6.1.4 => 6.1.4 
    @mui/lab: 6.0.0-beta.12 => 6.0.0-beta.12 
    @mui/material: ^6.1.4 => 6.1.4 
    @mui/private-theming:  6.1.4 
    @mui/styled-engine:  6.1.4 
    @mui/system:  6.1.4 
    @mui/types:  7.2.18 
    @mui/utils:  6.1.4 
    @types/react: ^18.3.10 => 18.3.11 
    react: ^18.3.1 => 18.3.1 
    react-dom: ^18.3.1 => 18.3.1 
    typescript: ^5.5.3 => 5.6.3 

Search keywords: vite

@pavankjadda pavankjadda added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant