-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Add option to disable esbuild plugin in vite #456
Comments
In theory, the esbuild is already do same thing with @babel/preset-typescript and @vue/babel-preset-jsx, so you don't rely on them.I don't konw the reason which you use them instead of esbuild, can you explain it in detail? |
@underfin it's related to render function. In Vue 3 the render function has different format to props data (https://github.com/vuejs/rfcs/blob/master/active-rfcs/0008-render-function-api-change.md). I think esbuild by default will transform jsx syntax to similar react format which vue 2's render function isnt compatible with. |
@haoleanh just coming across this and I was curious if the frontend build pipeline you mentioned was open sourced anywhere? I'm interested in using vite for my team's vue 2 app, but I'm running into the tsx roadblock as well. |
@Aaron-Pool we wrote a custom build based on babel and vite pipeline. The idea is to disable default Esbuild in Vite and use existing babel plugins to transform tsx to Vue 2 render format. Here is our code, its been a while since I used Vite (its more like experiment for us to try esm build) so Im not sure if this still works in latest Vite version. Custom transformer
Custom resolver
Custom server plugin
Serve config (build config is similar)
|
@haoleanh Great! Thanks! 👍 |
Is your feature request related to a problem? Please describe.
We managed to make Vite works with Vue 2 tsx (via babel plugin using @babel/preset-typescript and @vue/babel-preset-jsx). The problem is that Vite esbuild plugin always transform the code before it goes to our custom transformation.
Describe the solution you'd like
A setting in vite config or cli flag to disable esbuild plugin
Describe alternatives you've considered
We modified vite server source code to disable esbuild plugin and it works well for us
Additional context
Disable esbuild plugin
And here is the result :)
The text was updated successfully, but these errors were encountered: