Skip to content

Commit

Permalink
docs: refine README
Browse files Browse the repository at this point in the history
  • Loading branch information
Haixing-Hu committed Dec 27, 2023
1 parent 23809ec commit 5bbb96a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ This library uses the most recent (currently May 2023)
the version of the [Babel] plugin [@babel/plugin-proposal-decorators] must be
at least `7.23.0`.

**Note:** There is a critical bug in versions of `@babel/helpers` greater than
`7.23.0` but less than `8.0.0` (not yet released). It incorrectly sets the `kind`
property in the context of decorators on classes to `'field'` when it should be
`'class'`. For more details, refer to [Babel]'s [issue #16179] and [issue #16180].
Therefore, we need to enforce the use of version `7.23.0` of `@babel/helpers` in
`package.json`. Specifically, add the following code to `package.json`:
```json
{
"resolutions": {
"@babel/helpers": "7.23.0"
}
}
```

### <span id="webpack">Bundling with [webpack]</span>

1. Install the required dependencies:
Expand Down Expand Up @@ -993,3 +1007,5 @@ See the [LICENSE](LICENSE) file for more details.
[GitHub repository]: https://github.com/Haixing-Hu/vue3-class-component
[@haixing_hu/typeinfo]: https://npmjs.com/package/@haixing_hu/typeinfo
[@haixing_hu/clone]: https://npmjs.com/package/@haixing_hu/clone
[issue #16179]: https://github.com/babel/babel/issues/16179
[issue #16180]: https://github.com/babel/babel/issues/16180
15 changes: 15 additions & 0 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ npm install @haixing_hu/vue3-class-component @haixing_hu/typeinfo @haixing_hu/cl
**注意:** 为了支持 [JavaScript 装饰器元数据第3阶段提案],
插件 [@babel/plugin-proposal-decorators] 的版本号必须至少为 `7.23.0`

**注意:** `@babel/helpers` 在大于 `7.23.0` 但小于 `8.0.0` (尚未发布) 的版本上,有个
严重的 bug:它错误地将装饰在类上的装饰器的上下文中的 `kind` 属性设置为 `'field'`,而实际上应
设置为 `'class'`。更多详细信息,请参见 [Babel][issue #16179][issue #16180]
因此,我们需要在 `package.json` 中强制使用 `7.23.0` 版本的 `@babel/helpers`。具体而言,
应该在 `package.json`中加上下面这段代码:
```json
{
"resolutions": {
"@babel/helpers": "7.23.0"
}
}
```

### <span id="webpack">使用 [webpack] 打包</span>

1. 安装需要的依赖:
Expand Down Expand Up @@ -905,3 +918,5 @@ export default toVue(MyComponent);
[GitHub 仓库]: https://github.com/Haixing-Hu/vue3-class-component
[@haixing_hu/typeinfo]: https://npmjs.com/package/@haixing_hu/typeinfo
[@haixing_hu/clone]: https://npmjs.com/package/@haixing_hu/clone
[issue #16179]: https://github.com/babel/babel/issues/16179
[issue #16180]: https://github.com/babel/babel/issues/16180
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@haixing_hu/vue3-class-component",
"version": "1.8.1",
"version": "1.8.2",
"description": "A JavaScript class decorator for Vue3 components",
"main": "dist/vue-class-component.cjs.min.js",
"module": "dist/vue-class-component.esm.min.mjs",
Expand Down

0 comments on commit 5bbb96a

Please sign in to comment.