webpack 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,7 @@ class FunctionModuleTemplatePlugin {
28
28
  if(Array.isArray(module.providedExports))
29
29
  source.add("/* exports provided: " + module.providedExports.join(", ") + " */\n");
30
30
  else if(module.providedExports)
31
- source.add("/* unknown exports provided */\n");
31
+ source.add("/* no static exports found */\n");
32
32
  if(Array.isArray(module.usedExports))
33
33
  source.add("/* exports used: " + module.usedExports.join(", ") + " */\n");
34
34
  else if(module.usedExports)
@@ -19,9 +19,7 @@ class JsonpMainTemplatePlugin {
19
19
  this.indent(
20
20
  chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(",\n")
21
21
  ),
22
- "};",
23
- "",
24
- "var resolvedPromise = new Promise(function(resolve) { resolve(); });"
22
+ "};"
25
23
  ]);
26
24
  }
27
25
  return source;
@@ -81,26 +79,27 @@ class JsonpMainTemplatePlugin {
81
79
  });
82
80
  mainTemplate.plugin("require-ensure", function(_, chunk, hash) {
83
81
  return this.asString([
84
- "if(installedChunks[chunkId] === 0) {",
82
+ "var installedChunkData = installedChunks[chunkId];",
83
+ "if(installedChunkData === 0) {",
85
84
  this.indent([
86
- "return resolvedPromise;"
85
+ "return new Promise(function(resolve) { resolve(); });"
87
86
  ]),
88
87
  "}",
89
88
  "",
90
89
  "// a Promise means \"currently loading\".",
91
- "if(installedChunks[chunkId]) {",
90
+ "if(installedChunkData) {",
92
91
  this.indent([
93
- "return installedChunks[chunkId][2];"
92
+ "return installedChunkData[2];"
94
93
  ]),
95
94
  "}",
96
95
  "",
97
96
  "// setup Promise in chunk cache",
98
97
  "var promise = new Promise(function(resolve, reject) {",
99
98
  this.indent([
100
- "installedChunks[chunkId] = [resolve, reject];"
99
+ "installedChunkData = installedChunks[chunkId] = [resolve, reject];"
101
100
  ]),
102
101
  "});",
103
- "installedChunks[chunkId][2] = promise;",
102
+ "installedChunkData[2] = promise;",
104
103
  "",
105
104
  "// start chunk loading",
106
105
  "var head = document.getElementsByTagName('head')[0];",
@@ -11,14 +11,8 @@ module.exports = class RequireEnsureDependenciesBlock extends AsyncDependenciesB
11
11
  super(chunkName, module, loc);
12
12
  this.expr = expr;
13
13
  const successBodyRange = successExpression && successExpression.body && successExpression.body.range;
14
- const errorBodyRange = errorExpression && errorExpression.body && errorExpression.body.range;
15
- this.range = null;
16
14
  if(successBodyRange) {
17
- if(errorBodyRange) {
18
- this.range = [successBodyRange[0] + 1, errorBodyRange[1] - 1];
19
- } else {
20
- this.range = [successBodyRange[0] + 1, successBodyRange[1] - 1];
21
- }
15
+ this.range = [successBodyRange[0] + 1, successBodyRange[1] - 1];
22
16
  }
23
17
  this.chunkNameRange = chunkNameRange;
24
18
  const dep = new RequireEnsureDependency(this);
@@ -21,9 +21,7 @@ class WebWorkerMainTemplatePlugin {
21
21
  return id + ": 1";
22
22
  }).join(",\n")
23
23
  ),
24
- "};",
25
- "",
26
- "var resolvedPromise = new Promise(function(resolve) { resolve(); });"
24
+ "};"
27
25
  ]);
28
26
  }
29
27
  return source;
@@ -31,22 +29,26 @@ class WebWorkerMainTemplatePlugin {
31
29
  mainTemplate.plugin("require-ensure", function(_, chunk, hash) {
32
30
  const chunkFilename = this.outputOptions.chunkFilename;
33
31
  return this.asString([
34
- "// \"1\" is the signal for \"already loaded\"",
35
- "if(!installedChunks[chunkId]) {",
32
+ "return new Promise(function(resolve) {",
36
33
  this.indent([
37
- "importScripts(" +
38
- this.applyPluginsWaterfall("asset-path", JSON.stringify(chunkFilename), {
39
- hash: "\" + " + this.renderCurrentHashCode(hash) + " + \"",
40
- hashWithLength: function(length) {
41
- return "\" + " + this.renderCurrentHashCode(hash, length) + " + \"";
42
- }.bind(this),
43
- chunk: {
44
- id: "\" + chunkId + \""
45
- }
46
- }) + ");"
34
+ "// \"1\" is the signal for \"already loaded\"",
35
+ "if(!installedChunks[chunkId]) {",
36
+ this.indent([
37
+ "importScripts(" +
38
+ this.applyPluginsWaterfall("asset-path", JSON.stringify(chunkFilename), {
39
+ hash: "\" + " + this.renderCurrentHashCode(hash) + " + \"",
40
+ hashWithLength: function(length) {
41
+ return "\" + " + this.renderCurrentHashCode(hash, length) + " + \"";
42
+ }.bind(this),
43
+ chunk: {
44
+ id: "\" + chunkId + \""
45
+ }
46
+ }) + ");"
47
+ ]),
48
+ "}",
49
+ "resolve();"
47
50
  ]),
48
- "}",
49
- "return resolvedPromise;"
51
+ "});"
50
52
  ]);
51
53
  });
52
54
  mainTemplate.plugin("bootstrap", function(source, chunk, hash) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "author": "Tobias Koppers @sokra",
5
5
  "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
6
6
  "dependencies": {