-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
fix(plugin-vue): enable ts in template when using tsx in dev mode #10180
Conversation
Isn't it already supported by |
It's not about <template>
{{ a as any }}
</template>
<script lang="tsx" setup>
const a = 1
</script> In dev mode, browser will throw a error, because it was compiled to function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return _toDisplayString($setup.a as any)
} TS grammar is not converted. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return _toDisplayString($setup.a);
} TS grammar is converted. The key code is vite/packages/plugin-vue/src/main.ts Lines 214 to 233 in 43b7b78
It lacks tsx's judgment |
Can you please review this PR,there is still no reviewer @antfu |
@LiZhequ this isn't valid for Vue. You need to use |
@patak-dev vite/packages/plugin-vue/src/template.ts Lines 157 to 163 in c4489ea
@vite/plugin-vue-jsx tranform jsx syntactic,but the template is still handled by @vite/plugin-vue . And as I said above, it lacks tsx's judgment in vite/packages/plugin-vue/src/main.ts Lines 214 to 233 in 43b7b78
|
Description
TS is not supported in template when lang is tsx in dev mode. It is supported in prod mode.
transformWithEsbuild
should be called when lang is tsxAdditional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).