@vitejs/plugin-vue 4.2.0 cannot use component function
Vue version
3.2.47
Link to minimal reproduction
Steps to reproduce
<template>
<div>
<Lists :list="list" />
</div>
</template>
<script lang="tsx" setup>
const list = [1, 2, 3, 4, 5]
const Lists = props => (
<div>
{props.list.map(item => (
<li>{item}</li>
))}
</div>
)
</script>
package.json
{
"dependencies": {
"@vitejs/plugin-vue-jsx": "^3.0.1",
"vue": "^3.2.47"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.2.0",
"typescript": "^5.0.4",
"vite": "^4.3.2",
"vue-tsc": "^1.4.4"
}
}
@vitejs/plugin-vue 4.1.0 is run well
What is expected?
show list
What is actually happening?
Expected "}" but found "." 9 | const Lists = props => ( 10 |
11 | {props.list.map(item => (
| ^
12 | {item}
13 | ))}
System Info
No response
Any additional comments?
No response
If you want to use JSX syntax in SFC, you should use the corresponding plugin.
I have use @vitejs/plugin-vue-jsx
my vite.config
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
export default defineConfig({
plugins: [
vue(),
vueJsx(),
]
})
not work when I use @vitejs/plugin-vue 4.1.0 it's work well