Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

How to use JSX in a script? #13069

Discussion options

When I used create-vue to create a project, I chose to add JSX. But when I tested using JSX, I got an error and the following prompt. I want to ask if I need to add any additional configurations to use JSX properly
image
image
I tried to add the following configuration in tsconfig.json, but still couldn't solve the problem:
"compilerOptions": {
"types": ["element-plus/global"],
"jsx": "preserve",
"jsxImportSource": "vue"
}

You must be logged in to vote

To use JSX in your script, you need to declare the pre-processor language as tsx or jsx using the lang attribute. Here's an example: Playground

-<script setup lang="ts">
+<script setup lang="tsx">

Replies: 1 comment 1 reply

Comment options

To use JSX in your script, you need to declare the pre-processor language as tsx or jsx using the lang attribute. Here's an example: Playground

-<script setup lang="ts">
+<script setup lang="tsx">
You must be logged in to vote
1 reply
Comment options

Thank you very much for your help

Answer selected by Alfred-Skyblue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /