Skip to content

Commit c593011

Browse files
authored
docs(guides): fix typo in tree-shaking.md (#4164)
1 parent ccb20eb commit c593011

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/content/guides/tree-shaking.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ The [`sideEffects`](/configuration/optimization/#optimizationsideeffects) and [`
180180

181181
__`sideEffects` is much more effective__ since it allows to skip whole modules/files and the complete subtree.
182182

183-
`usedExports` relies on [terser](https://github.com/terser-js/terser) to detect side effects in statements. It is a difficult task in JavaScript and not as effective as straighforward `sideEffects` flag. It also can't skip subtree/dependencies since the spec says that side effects need to be evaluated. While exporting function works fine, React's Higher Order Components (HOC) are problematic in this regard.
183+
`usedExports` relies on [terser](https://github.com/terser-js/terser) to detect side effects in statements. It is a difficult task in JavaScript and not as effective as straightforward `sideEffects` flag. It also can't skip subtree/dependencies since the spec says that side effects need to be evaluated. While exporting function works fine, React's Higher Order Components (HOC) are problematic in this regard.
184184

185185
Let's make an example:
186186

@@ -241,7 +241,9 @@ Terser actually tries to figure it out, but it doesn't know for sure in many cas
241241

242242
But we can help terser by using the `/*#__PURE__*/` annotation. It flags a statement as side effect free. So a simple change would make it possible to tree-shake the code:
243243

244-
`var Button$1 = /*#__PURE__*/ withAppProvider()(Button);`
244+
```javascript
245+
var Button$1 = /*#__PURE__*/ withAppProvider()(Button);
246+
```
245247

246248
This would allow to remove this piece of code. But there are still questions with the imports which need to be included/evaluated because they could contain side effects.
247249

0 commit comments

Comments
 (0)