Skip to content

Commit d4bb897

Browse files
Lxdlljacob-lcs
andauthored
docs(cn): update tree-shaking.mdx (#1760)
* Update tree-shaking.mdx * Update src/content/guides/tree-shaking.mdx Co-authored-by: Jacob <jacob.lcs@qq.com>
1 parent 06aff71 commit d4bb897

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/guides/tree-shaking.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ export { default as ButtonGroup } from './ButtonGroup';
317317

318318
## 将函数调用标记为无副作用 $#mark-a-function-call-as-side-effect-free$
319319

320-
是可以告诉 webpack 一个函数调用是无副作用的,只要通过 `/*#__PURE__*/` 注释。它可以被放到函数调用之前,用来标记它们是无副作用的(pure)。传到函数中的入参是无法被刚才的注释所标记,需要单独每一个标记才可以。如果一个没被使用的变量定义的初始值被认为是无副作用的(pure),它会被标记为死代码,不会被执行且会被压缩工具清除掉。这个行为被会开启当 [`optimization.innerGraph`](/configuration/optimization/#optimizationinnergraph) 被设置成 `true`
320+
是可以告诉 webpack 一个函数调用是无副作用的,只要通过 `/*#__PURE__*/` 注释。它可以被放到函数调用之前,用来标记它们是无副作用的(pure)。传到函数中的入参是无法被刚才的注释所标记,需要单独每一个标记才可以。如果一个没被使用的变量定义的初始值被认为是无副作用的(pure),它会被标记为死代码,不会被执行且会被压缩工具清除掉。 [`optimization.innerGraph`](/configuration/optimization/#optimizationinnergraph) 被设置成 `true` 时这个行为会被启用
321321

322322
**file.js**
323323

0 commit comments

Comments
 (0)