Skip to content

Commit 02f5fec

Browse files
committed
docs: add information about the optimize option
closes #48
1 parent f84b81a commit 02f5fec

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: packages/babel-plugin-jsx/README-zh_CN.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ Type: `boolean`
4141

4242
Default: `false`
4343

44-
是否开启优化. 如果你对 Vue 3 不太熟悉,不建议打开
44+
开启此选项后,JSX 插件会尝试使用 [`PatchFlags`](https://cn.vuejs.org/guide/extras/rendering-mechanism#patch-flags)[`SlotFlags`](https://github.com/vuejs/core/blob/v3.5.13/packages/runtime-core/src/componentSlots.ts#L69-L77) 来优化运行时代码,从而提升渲染性能。需要注意的是,JSX 的灵活性远高于模板语法,这使得编译优化的可能性相对有限,其优化效果会比 Vue 官方模板编译器更为有限。
45+
46+
优化后的代码会选择性地跳过一些重渲染操作以提高性能。因此,建议在开启此选项后对应用进行完整的测试,确保所有功能都能正常工作。
4547

4648
#### isCustomElement
4749

Diff for: packages/babel-plugin-jsx/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ Type: `boolean`
4141

4242
Default: `false`
4343

44-
enable optimization or not. It's not recommended to enable it If you are not familiar with Vue 3.
44+
When enabled, this plugin generates optimized runtime code using [`PatchFlags`](https://vuejs.org/guide/extras/rendering-mechanism#patch-flags) and [`SlotFlags`](https://github.com/vuejs/core/blob/v3.5.13/packages/runtime-core/src/componentSlots.ts#L69-L77) to improve rendering performance. However, due to JSX's dynamic nature, the optimizations are not as comprehensive as those in Vue's official template compiler.
45+
46+
Since the optimized code may skip certain re-renders to improve performance, we strongly recommend thorough testing of your application after enabling this option to ensure everything works as expected.
4547

4648
#### isCustomElement
4749

0 commit comments

Comments
 (0)