microsoft / griffel

CSS-in-JS with ahead-of-time compilation ⚡️
https://griffel.js.org
MIT License
1.2k stars 61 forks source link

fix(postcss-syntax): throw error when parsing TS #553

Closed YuanboXue-Amber closed 6 months ago

YuanboXue-Amber commented 6 months ago

When using @griffel/postcss-syntax parse on TS code:

parse(`import type { Something } from 'somwhere'`, {
  babelOptions: {
    presets: ["@babel/preset-typescript"],
  },
});

It throws error 💥 Unexpected token, expected "from".

This happens because presets config is not used when transforming code with Babel.

This PR takes the babelOptions presets/plugins and use it during transform.

github-actions[bot] commented 6 months ago

📊 Bundle size report

🤖 This report was generated against b1ab99887757fd6cf2eb66abf203c3eef93abd9d