Add minor edits to babel-helper-annotate-as-pure README [skip ci]

This commit is contained in:
Brian Ng 2017-09-25 11:00:38 -05:00 committed by GitHub
parent 413ffe6639
commit 4bd9d751f4

View File

@ -23,14 +23,18 @@ traverse(file, {
## Caveat with UglifyJS pre v3.1.0
`babel-helper-annotate-as-pure` concatenates existing leading comments to the `#__PURE__` annotation, but versions of UglifyJS before v3.1.0 checks only the last leading comment for the annotation.
`babel-helper-annotate-as-pure` will append any existing leading comments to the `#__PURE__` annotation. Versions of UglifyJS prior to v3.1.0 will **ignore** these annotations, as they only check the _last_ leading comment for the annotation.
For example, using the `Usage` snippet above:
**In**
So for the example input when annotating all CallExpressions:
```js
const four = /* foo */ add(2, 2);
```
it produces:
**Out**
```js
const four = /* #__PURE__ */ /* foo */ add(2, 2);
```
and such generated annotation will be ignored in those previous versions of the UglifyJS.