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

Pigment CSS Vite example broken #43487

Closed
Morabotti opened this issue Aug 27, 2024 · 9 comments
Closed

Pigment CSS Vite example broken #43487

Morabotti opened this issue Aug 27, 2024 · 9 comments
Assignees
Labels
bug 🐛 Something doesn't work examples Relating to /examples package: pigment-css Specific to @pigment-css/* platform: windows

Comments

@Morabotti
Copy link

Morabotti commented Aug 27, 2024

Steps to reproduce

Link to live example: /examples/material-ui-pigment-css-vite-ts

Steps:

  1. Follow the README instructions
  2. Receive following error to the console while running npm run dev:
Uncaught Error: @pigment-css/react: You were trying to call "generateAtomics" function without configuring your bundler. Make sure to install the bundler specific plugin and use it. @pigment-css/vite-plugin for Vite integration or @pigment-css/nextjs-plugin for Next.js integration.

Current behavior

Not working

Expected behavior

Things to work

Context

No response

Your environment

Environment

  System:
    OS: Windows 10 10.0.19045
  Binaries:
    Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.4.1 - ~\AppData\Roaming\npm\npm.CMD
    pnpm: Not Found
  Browsers:
    Chrome: 128.0.6613.84
    Edge: Chromium (127.0.2651.74)
  npmPackages:
    @emotion/react:  11.13.3
    @emotion/styled:  11.13.0
    @mui/core-downloads-tracker:  6.0.0
    @mui/material: next => 6.0.0-rc.0
    @mui/material-pigment-css: next => 6.0.0-rc.0
    @mui/private-theming:  6.0.0-rc.0
    @mui/styled-engine:  6.0.0-rc.0
    @mui/system:  6.0.0-rc.0
    @mui/types:  7.2.16
    @mui/utils:  6.0.0-rc.0
    @pigment-css/react:  0.0.20
    @pigment-css/vite-plugin: latest => 0.0.20
    @types/react: latest => 18.3.4
    react: latest => 18.3.1
    react-dom: latest => 18.3.1
    typescript: latest => 5.5.4

Search keywords: vite, pigment-css

@Morabotti Morabotti added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 27, 2024
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work package: pigment-css Specific to @pigment-css/* examples Relating to /examples labels Aug 27, 2024
@mnajdova mnajdova self-assigned this Aug 28, 2024
@mnajdova
Copy link
Member

Thanks for the report. I am updating all examples in #43494 to use the latest tag instead of next. Using these versions the project runs successfully. These are the versions I ended up with:

  System:
    OS: macOS 14.1.2
  Binaries:
    Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v20.15.0/bin/npm
    pnpm: 9.7.1 - ~/.nvm/versions/node/v20.15.0/bin/pnpm
  Browsers:
    Chrome: 128.0.6613.85
    Edge: Not Found
    Safari: 17.1.2
  npmPackages:
    @emotion/react:  11.13.3 
    @emotion/styled:  11.13.0 
    @mui/core-downloads-tracker:  6.0.0 
    @mui/material: latest => 6.0.0 
    @mui/material-pigment-css: latest => 6.0.0 
    @mui/private-theming:  6.0.0 
    @mui/styled-engine:  6.0.0 
    @mui/system:  6.0.0 
    @mui/types:  7.2.16 
    @mui/utils:  6.0.0 
    @pigment-css/react:  0.0.20 
    @pigment-css/vite-plugin: latest => 0.0.20 
    @types/react: latest => 18.3.4 
    react: latest => 18.3.1 
    react-dom: latest => 18.3.1 
    typescript: latest => 5.5.4 

Can you verify that it works when using the latest tag for all @mui/* dependencies?

@Morabotti
Copy link
Author

That does not fix the issue for me. Tested with npm run dev and npm run build && npm run preview. Same problem:

  System:
    OS: Windows 11 10.0.22631
  Binaries:
    Node: 20.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: Not Found
  Browsers:
    Chrome: Not Found
    Edge: Chromium (127.0.2651.74)
  npmPackages:
    @emotion/react:  11.13.3
    @emotion/styled:  11.13.0
    @mui/core-downloads-tracker:  6.0.0
    @mui/material: latest => 6.0.0
    @mui/material-pigment-css: latest => 6.0.0
    @mui/private-theming:  6.0.0
    @mui/styled-engine:  6.0.0
    @mui/system:  6.0.0
    @mui/types:  7.2.16
    @mui/utils:  6.0.0
    @pigment-css/react:  0.0.20
    @pigment-css/vite-plugin: latest => 0.0.20
    @types/react: latest => 18.3.4
    react: latest => 18.3.1
    react-dom: latest => 18.3.1
    typescript: latest => 5.5.4

Note that the npm run build does not work out of the box either because of the tsc check. It results the following "error":

> tsc -b

src/App.tsx:1:1 - error TS6133: 'React' is declared but its value is never read.

1 import * as React from 'react';
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error.

@mnajdova
Copy link
Member

Can you please share your repo? Or just create a GitHub repository as a minimal reproduction.

I noticed the TS error, we can fix it separately.

@mnajdova mnajdova removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 28, 2024
@Morabotti
Copy link
Author

This is basically a duplicate from the example project. Steps to reproduce:

  1. Clone the repo
  2. npm install
  3. npm run dev

I've reproduced this on two machines, Windows 10 and Windows 11. Only tested with npm and Node 20.

@mnajdova
Copy link
Member

I was testing on MacOS, sorry. I was able to reproduce on Windows. We'll look into it.

@mnajdova mnajdova assigned brijeshb42 and unassigned mnajdova Aug 28, 2024
@brijeshb42
Copy link
Contributor

brijeshb42 commented Aug 28, 2024

Let me check this on a Windows machine if I can find it. We recently fixed this issue in general (atleast I thought I did). So seems related to that except some OS specific thing that needs to be handled as well.

@mnajdova
Copy link
Member

@Morabotti the issue has been fixed in mui/pigment-css#218, it will be released in "0.0.22" (both for the vite and nextjs plugins). If you want to try it locally before it, you can use this package version:

{
  "@pigment-css/vite-plugin": "https://pkg.csb.dev/mui/pigment-css/commit/9462e64b/@pigment-css/vite-plugin"
}

@Morabotti
Copy link
Author

This fixed the issue. Thanks.

Copy link

github-actions bot commented Sep 4, 2024

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

We value your feedback @Morabotti! How was your experience with our support team?
If you could spare a moment, we'd love to hear your thoughts in this brief Support Satisfaction survey. Your insights help us improve!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work examples Relating to /examples package: pigment-css Specific to @pigment-css/* platform: windows
Projects
Status: Done
Development

No branches or pull requests

4 participants