mui / pigment-css

Pigment CSS is a zero-runtime CSS-in-JS library that extracts the colocated styles to their own CSS files at build time.
MIT License
820 stars 39 forks source link

Can't parse JS modules exported from index files in TS project #295

Open bromanazzi opened 3 weeks ago

bromanazzi commented 3 weeks ago

Steps to reproduce

https://codesandbox.io/p/github/bromanazzi/pigment-test/main

  1. Open the preview

Current behavior

Shows the error Unexpected token, expected: ","

However, if you go to App.tsx and change the Button import to the component file (./Button/Button) it works normally.

Expected behavior

It should render the button normally

Context

We're trying to add pigment to a large project with both js and ts. On starting our server with the pigment plugin active, vite throws this kind of error for hundreds of .jsx files. It seems like it's trying to parse the files as ts. On empty fragments <> for example, it says that Type parameter list cannot be empty.

Your environment

npx @mui/envinfo ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```

Search keywords: typescript modules export transform parse