macaron-css / macaron

Compiler-augmented typesafe CSS-in-JS with zero runtime, colocation, maximum safety and productivity
https://macaron.js.org/
MIT License
735 stars 16 forks source link

Ability to extend babel config in Vite? #38

Closed dugip closed 1 year ago

dugip commented 1 year ago

In the app I'm using Macaron in, we have decorators, which I enable like this in Vite:

plugins: [
  ...
  react({
    babel: {
      plugins: [
        ['@babel/plugin-proposal-decorators', { legacy: true }],
        ['@babel/plugin-proposal-class-properties', { loose: false }],
      ],
    },
  }),
  macaronVitePlugin(),
],

This configuration doesn't extend to Macaron when I add it to the plugins, and I get this error

App.tsx: Support for the experimental syntax 'decorators' isn't currently enabled (39:1):

Would it be possible to extend the API of the Vite plugin to allow users to pass in additional plugins/presets to the babel config in @macaron-css/integration?

https://github.com/macaron-css/macaron/blob/main/packages/integration/src/babel.ts#L11

dugip commented 1 year ago

@Mokshit06 I'd like your feedback on the open PRs and get them merged if possible. I'd appreciate your input!

Mokshit06 commented 1 year ago

The PR looks good, will merge. Thanks!