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

Allow to use esbuild plugins #2779

Closed
jarandmi opened this issue Mar 30, 2021 · 1 comment
Closed

Allow to use esbuild plugins #2779

jarandmi opened this issue Mar 30, 2021 · 1 comment

Comments

@jarandmi
Copy link

jarandmi commented Mar 30, 2021

When using esbuild instead of babel for the transforming, you miss out of using babel plugins. Today we use esbuild and puild our own plugin (esbuild-plugin-styled-component) to transform the css props supported in Styled Components (with a babel plugin) to React components.

I can't find any way to use this plugin with Vite2.

Suggested solution

What if we could send the plugins to our Vite configs esbuild object?

export default {
  esbuild: {
    plugins: [styledComponentsPlugin()]
  }
}

Additional context

Probably this should be solved in another way. Instead of using babel as a way of transform CSS props from Styled Components, there should be a native way for esbuild to transform css props. But anyway we need a way to tell esbuild to use this plugin.

@patak-dev
Copy link
Member

When Vite uses esbuild for transpiling individual files, AFAICS there is no way to use plugins for transforming. esbuild plugins are used for bundling (build).
Check out this comment and issue #2238 (comment), where there is a link to the rationale from Evan Wallace evanw/esbuild#779 (comment)
Closing this issue as we are already discussing this in #2238

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants