Open 604587986 opened 3 years ago
We support tsx
when <script lang="tsx">
I still hope it supports formatting jsx lang
You can use the [vite-plugin-lang-jsx] plugin,Configure invite.config.js
, like :
//vite.config.js
import { defineConfig } from 'vite'
import vue2 from "@vitejs/plugin-vue2";
import vueJsx from "@vitejs/plugin-vue2-jsx";
import langJsx from "vite-plugin-lang-jsx";
export default defineConfig({
plugins: [
langJsx(), //langJsx must precede vue
vue2(),
vueJsx()
]
})
This way you don’t have to write lang="jsx"
in <script></script>
,Refer to my Demo[vite-vue2-jsx].
Feature Request
<script lang="jsx">
@vitejs/plugin-vue-jsx need this way of writing, but vetur cannot format jsx or tsx