Skip to content

Commit 1189b21

Browse files
committed
docs(plugins): add module-concatenation-plugin
Add docs for the `ModuleConcatenationPlugin` added in v3. This is the last step of completing #1318. Resolves #1318
1 parent e7eeacd commit 1189b21

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: ModuleConcatenationPlugin
3+
contributors:
4+
- skipjack
5+
- TheLarkInn
6+
related:
7+
- webpack 3: Official Release!!
8+
---
9+
10+
In the past, one of webpack’s trade-offs when bundling was that each module in your bundle would be wrapped in individual function closures. These wrapper functions made it slower for your JavaScript to execute in the browser. In comparison, tools like Closure Compiler and RollupJS ‘hoist’ or concatenate the scope of all your modules into one closure and allow for your code to have a faster execution time in the browser.
11+
12+
This plugin will enable the same concatenation behavior in webpack.
13+
14+
``` js
15+
new webpack.optimize.ModuleConcatenationPlugin()
16+
```
17+
18+
> Scope Hoisting is specifically a feature made possible by ECMAScript Module syntax. Because of this webpack may fallback to normal bundling based on what kind of modules you are using, and [other conditions](https://medium.com/webpack/webpack-freelancing-log-book-week-5-7-4764be3266f5).

0 commit comments

Comments
 (0)