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

how to format lang="jsx" in .vue file #2781

Open
604587986 opened this issue Mar 15, 2021 · 3 comments
Open

how to format lang="jsx" in .vue file #2781

604587986 opened this issue Mar 15, 2021 · 3 comments

Comments

@604587986
Copy link

604587986 commented Mar 15, 2021

Feature Request

<script lang="jsx">

@vitejs/plugin-vue-jsx need this way of writing, but vetur cannot format jsx or tsx

@yoyo930021
Copy link
Member

We support tsx when <script lang="tsx">

@604587986
Copy link
Author

I still hope it supports formatting jsx lang

@XibeiGitHub
Copy link

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].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants