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

Adding the Pigment CSS vite-plugin to Remix causes a CJS build #232

Closed
endaquigley opened this issue Sep 11, 2024 · 3 comments
Closed

Adding the Pigment CSS vite-plugin to Remix causes a CJS build #232

endaquigley opened this issue Sep 11, 2024 · 3 comments
Assignees
Labels
duplicate This issue or pull request already exists vite
Milestone

Comments

@endaquigley
Copy link

endaquigley commented Sep 11, 2024

Steps to reproduce

  1. Install the @pigment-css/vite-plugin package inside your Remix project.
  2. Add the pigment plugin to vite.config.ts with a basic config.
  3. Run npm run build and check the output.

https://stackblitz.com/edit/remix-run-remix-aroqz5

Current behavior

Vite performs a CJS build for some reason:

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.

Expected behavior

Vite should perform an ESM build as type="module" is set in package.json and the file extension is vite.config.ts

Context

Removing the pigment plugin causes Vite to performs a ESM build again:

pigment({
  theme: extendTheme(),
  transformLibraries: ['@mui/material'],
})

Your environment

npx @mui/envinfo
  System:
    OS: Linux 5.0 undefined
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  Browsers:
    Chrome: Not Found
  npmPackages:
    @emotion/react:  11.13.0 
    @emotion/styled:  11.13.0 
    @mui/core-downloads-tracker:  6.1.0 
    @mui/material: 6.1.0 => 6.1.0 
    @mui/material-pigment-css: 6.1.0 => 6.1.0 
    @mui/private-theming:  6.1.0 
    @mui/styled-engine:  6.1.0 
    @mui/system: 6.1.0 => 6.1.0 
    @mui/types:  7.2.16 
    @mui/utils:  6.1.0 
    @pigment-css/react:  0.0.22 
    @pigment-css/vite-plugin: ^0.0.22 => 0.0.22 
    @types/react: ^18.2.20 => 18.3.3 
    react: ^18.2.0 => 18.3.1 
    react-dom: ^18.2.0 => 18.3.1 
    typescript: ^5.1.6 => 5.5.3 

Search keywords: vite, cjs, performance, remix

@endaquigley endaquigley added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 11, 2024
@brijeshb42 brijeshb42 added this to the Road to v1 milestone Sep 12, 2024
@brijeshb42
Copy link
Contributor

Pigment CSS depends on some of the @mui/* packages internally. We'll be moving away from that which would automatically fix this.

@oliviertassinari
Copy link
Member

Is this issue a duplicate of #67?

@oliviertassinari oliviertassinari removed performance status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 12, 2024
@oliviertassinari
Copy link
Member

Duplicate of #67

@oliviertassinari oliviertassinari marked this as a duplicate of #67 Oct 12, 2024
@github-actions github-actions bot added the duplicate This issue or pull request already exists label Oct 12, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists vite
Projects
None yet
Development

No branches or pull requests

5 participants