Skip to content

Commit 2def8b4

Browse files
committed
feat(moduletemplate): Wrap function module template wrappers with parens
Back-ports c7b06ad (webpack#3658) to webpack-1 based on https://twitter.com/TheLarkInn/status/815230804729196544.
1 parent e666686 commit 2def8b4

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

lib/FunctionModuleTemplatePlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ FunctionModuleTemplatePlugin.prototype.apply = function(moduleTemplate) {
1515
if((module.arguments && module.arguments.length !== 0) || module.hasDependencies()) {
1616
defaultArguments.push("__webpack_require__");
1717
}
18-
source.add("/***/ function(" + defaultArguments.concat(module.arguments || []).join(", ") + ") {\n\n");
18+
source.add("/***/ (function(" + defaultArguments.concat(module.arguments || []).join(", ") + ") {\n\n");
1919
source.add(new PrefixSource(this.outputOptions.sourcePrefix, moduleSource));
20-
source.add("\n\n/***/ }");
20+
source.add("\n\n/***/ })");
2121
return source;
2222
});
2323
moduleTemplate.plugin("package", function(moduleSource, module) {

test/statsCases/chunks/expected.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ Hash: 27b51279f30c19c26769
22
Time: Xms
33
Asset Size Chunks Chunk Names
44
bundle.js 3.83 kB 0 [emitted] main
5-
1.bundle.js 159 bytes 1 [emitted]
6-
2.bundle.js 101 bytes 2 [emitted]
7-
3.bundle.js 180 bytes 3 [emitted]
5+
1.bundle.js 161 bytes 1 [emitted]
6+
2.bundle.js 103 bytes 2 [emitted]
7+
3.bundle.js 184 bytes 3 [emitted]
88
chunk {0} bundle.js (main) 73 bytes [rendered]
99
> main [0] (webpack)/test/statsCases/chunks/index.js
1010
[0] (webpack)/test/statsCases/chunks/index.js 51 bytes {0} [built]

test/statsCases/define-plugin/expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ Child
33
Hash: 22655fdde3386763624e
44
Time: Xms
55
Asset Size Chunks Chunk Names
6-
bundle.js 1.43 kB 0 [emitted] main
6+
bundle.js 1.44 kB 0 [emitted] main
77
chunk {0} bundle.js (main) 24 bytes [rendered]
88
[0] (webpack)/test/statsCases/define-plugin/index.js 24 bytes {0} [built]
99
Child
1010
Hash: b84e3c3c9ea7106aac84
1111
Time: Xms
1212
Asset Size Chunks Chunk Names
13-
bundle.js 1.43 kB 0 [emitted] main
13+
bundle.js 1.44 kB 0 [emitted] main
1414
chunk {0} bundle.js (main) 24 bytes [rendered]
1515
[0] (webpack)/test/statsCases/define-plugin/index.js 24 bytes {0} [built]

test/statsCases/preset-verbose/expected.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ Hash: 27b51279f30c19c26769
22
Time: Xms
33
Asset Size Chunks Chunk Names
44
bundle.js 3.83 kB 0 [emitted] main
5-
1.bundle.js 159 bytes 1 [emitted]
6-
2.bundle.js 101 bytes 2 [emitted]
7-
3.bundle.js 180 bytes 3 [emitted]
5+
1.bundle.js 161 bytes 1 [emitted]
6+
2.bundle.js 103 bytes 2 [emitted]
7+
3.bundle.js 184 bytes 3 [emitted]
88
chunk {0} bundle.js (main) 73 bytes [rendered]
99
[0] (webpack)/test/statsCases/preset-verbose/index.js 51 bytes {0} [built]
1010
factory:Xms building:Xms = Xms

0 commit comments

Comments
 (0)