aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/glossary/tree_shaking
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/glossary/tree_shaking
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/glossary/tree_shaking')
-rw-r--r--files/zh-cn/glossary/tree_shaking/index.html32
1 files changed, 32 insertions, 0 deletions
diff --git a/files/zh-cn/glossary/tree_shaking/index.html b/files/zh-cn/glossary/tree_shaking/index.html
new file mode 100644
index 0000000000..24e8003e5e
--- /dev/null
+++ b/files/zh-cn/glossary/tree_shaking/index.html
@@ -0,0 +1,32 @@
+---
+title: Tree shaking
+slug: Glossary/Tree_shaking
+tags:
+ - JavaScript
+ - Modules
+ - Statement
+ - Web Performance
+ - export
+ - import
+ - tree shaking
+translation_of: Glossary/Tree_shaking
+---
+<p><strong>Tree shaking </strong>是一个通常用于描述移除 JavaScript 上下文中的未引用代码(dead-code) 行为的术语。</p>
+
+<p>它依赖于ES2015中的 <a href="/zh-CN/docs/Web/JavaScript/Reference/Statements/import">import</a> 和 <a href="/zh-CN/docs/Web/JavaScript/Reference/Statements/export">export</a> 语句,用来检测代码模块是否被导出、导入,且被 JavaScript 文件使用。</p>
+
+<p>在现代 JavaScript 应用程序中,我们使用模块打包(如<a href="https://webpack.js.org/">webpack</a>或<a href="https://github.com/rollup/rollup">Rollup</a>)将多个 JavaScript 文件打包为单个文件时自动删除未引用的代码。这对于准备预备发布代码的工作非常重要,这样可以使最终文件具有简洁的结构和最小化大小。</p>
+
+<h2 id="了解更多">了解更多</h2>
+
+<h4 id="常识">常识</h4>
+
+<ul>
+ <li><a href="http://exploringjs.com/es6/ch_modules.html#_benefit-dead-code-elimination-during-bundling">"捆绑过程中死代码消除的好处"</a> 在Axel Rauschmayer的书中:“探索JS:模块”</li>
+</ul>
+
+<h4 id="技术参数资料">技术参数资料</h4>
+
+<ul>
+ <li><a href="https://webpack.js.org/guides/tree-shaking/">用webpack实现Tree shaking</a></li>
+</ul>