You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the Vue JSX plugin relies on Babel for compilation, you need to additionally add the [@rsbuild/plugin-babel](https://www.npmjs.com/package/@rsbuild/plugin-babel).
40
+
41
+
Babel compilation will introduce extra overhead, in the example above, we use `include` to match `.jsx` and `.tsx` files, thereby reducing the performance cost brought by Babel.
42
+
43
+
After registering the plugin, you can use Vue's [JSX / TSX syntax](https://github.com/vuejs/jsx-vue2) in `.jsx`, `.tsx`, and `.vue` files.
44
+
45
+
## Vue SFC
46
+
47
+
When using JSX in Vue SFC, you need to add `lang="jsx"` or `lang="tsx"` to the `<script>` tag.
48
+
49
+
- JSX:
50
+
51
+
```html title="App.vue"
52
+
<scriptlang="jsx">
53
+
constvnode=<div>hello</div>;
54
+
</script>
55
+
```
56
+
57
+
- TSX:
58
+
59
+
```html title="App.vue"
60
+
<scriptlang="tsx">
61
+
constvnode=<div>hello</div>;
62
+
</script>
63
+
```
64
+
31
65
## Options
32
66
33
-
### foo
67
+
If you need to customize the compilation behavior of Vue JSX, you can use the following configs.
68
+
69
+
### vueJsxOptions
34
70
35
-
Some description.
71
+
Options passed to `@vue/babel-preset-jsx`, please refer to the [@vue/babel-preset-jsx documentation](https://github.com/vuejs/jsx-vue2) for detailed usage.
0 commit comments