Skip to content

Commit

Permalink
docs: add information about the optimize option
Browse files Browse the repository at this point in the history
closes #48
  • Loading branch information
haoqunjiang committed Feb 8, 2025
1 parent f84b81a commit 02f5fec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/babel-plugin-jsx/README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ Type: `boolean`

Default: `false`

是否开启优化. 如果你对 Vue 3 不太熟悉,不建议打开
开启此选项后,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 官方模板编译器更为有限。

优化后的代码会选择性地跳过一些重渲染操作以提高性能。因此,建议在开启此选项后对应用进行完整的测试,确保所有功能都能正常工作。

#### isCustomElement

Expand Down
4 changes: 3 additions & 1 deletion packages/babel-plugin-jsx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ Type: `boolean`

Default: `false`

enable optimization or not. It's not recommended to enable it If you are not familiar with Vue 3.
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.

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.

#### isCustomElement

Expand Down

0 comments on commit 02f5fec

Please sign in to comment.