From c867a4fc00230ed915bfd749d630d2f75d98f74a Mon Sep 17 00:00:00 2001 From: Mark Penner Date: Thu, 9 Jun 2016 14:09:54 -0700 Subject: [PATCH] Removed `sourcePrefix` option -- fixes https://github.com/webpack/webpack/issues/166#issuecomment-224710378 --- lib/FunctionModuleTemplatePlugin.js | 4 ++-- lib/WebpackOptionsDefaulter.js | 1 - test/statsCases/chunks/expected.txt | 6 +++--- test/statsCases/optimize-chunks/expected.txt | 16 ++++++++-------- test/statsCases/preset-verbose/expected.txt | 6 +++--- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/lib/FunctionModuleTemplatePlugin.js b/lib/FunctionModuleTemplatePlugin.js index 9bd251e10..777abdb29 100644 --- a/lib/FunctionModuleTemplatePlugin.js +++ b/lib/FunctionModuleTemplatePlugin.js @@ -16,8 +16,8 @@ FunctionModuleTemplatePlugin.prototype.apply = function(moduleTemplate) { defaultArguments.push("__webpack_require__"); } source.add("/***/ function(" + defaultArguments.concat(module.arguments || []).join(", ") + ") {\n\n"); - if(module.strict) source.add(this.outputOptions.sourcePrefix + "\"use strict\";\n"); - source.add(new PrefixSource(this.outputOptions.sourcePrefix, moduleSource)); + if(module.strict) source.add("\"use strict\";\n"); + source.add(moduleSource); source.add("\n\n/***/ }"); return source; }); diff --git a/lib/WebpackOptionsDefaulter.js b/lib/WebpackOptionsDefaulter.js index 0436c9a56..4604a0b41 100644 --- a/lib/WebpackOptionsDefaulter.js +++ b/lib/WebpackOptionsDefaulter.js @@ -58,7 +58,6 @@ function WebpackOptionsDefaulter() { this.set("output.hashFunction", "md5"); this.set("output.hashDigest", "hex"); this.set("output.hashDigestLength", 20); - this.set("output.sourcePrefix", "\t"); this.set("output.devtoolLineToLine", false); this.set("node", {}); diff --git a/test/statsCases/chunks/expected.txt b/test/statsCases/chunks/expected.txt index 1507e8c36..85ec67f6f 100644 --- a/test/statsCases/chunks/expected.txt +++ b/test/statsCases/chunks/expected.txt @@ -2,9 +2,9 @@ Hash: 55b4e00b04fd0c502b1f Time: Xms Asset Size Chunks Chunk Names bundle.js 5.29 kB 0 [emitted] main -1.bundle.js 252 bytes 1 [emitted] -2.bundle.js 107 bytes 2 [emitted] -3.bundle.js 202 bytes 3 [emitted] +1.bundle.js 251 bytes 1 [emitted] +2.bundle.js 106 bytes 2 [emitted] +3.bundle.js 200 bytes 3 [emitted] chunk {0} bundle.js (main) 73 bytes [rendered] > main [5] (webpack)/test/statsCases/chunks/index.js [0] (webpack)/test/statsCases/chunks/a.js 22 bytes {0} [built] diff --git a/test/statsCases/optimize-chunks/expected.txt b/test/statsCases/optimize-chunks/expected.txt index 555c61667..db2616b00 100644 --- a/test/statsCases/optimize-chunks/expected.txt +++ b/test/statsCases/optimize-chunks/expected.txt @@ -1,14 +1,14 @@ Hash: e3dc693bc52a75b4a39b Time: Xms Asset Size Chunks Chunk Names - 0.js 245 bytes 0 [emitted] cir1 - 1.js 215 bytes 1, 2 [emitted] abd - 2.js 131 bytes 2 [emitted] ab -main.js 6.03 kB 3 [emitted] main - 4.js 260 bytes 4 [emitted] cir2 - 5.js 138 bytes 5, 7 [emitted] chunk - 6.js 319 bytes 6, 4 [emitted] cir2 from cir1 - 7.js 79 bytes 7 [emitted] ac in ab + 0.js 244 bytes 0 [emitted] cir1 + 1.js 212 bytes 1, 2 [emitted] abd + 2.js 129 bytes 2 [emitted] ab +main.js 6.01 kB 3 [emitted] main + 4.js 259 bytes 4 [emitted] cir2 + 5.js 136 bytes 5, 7 [emitted] chunk + 6.js 317 bytes 6, 4 [emitted] cir2 from cir1 + 7.js 78 bytes 7 [emitted] ac in ab chunk {0} 0.js (cir1) 81 bytes {3} {6} {4} [rendered] > cir1 [7] (webpack)/test/statsCases/optimize-chunks/index.js 13:0-54 > duplicate cir1 from cir2 [3] (webpack)/test/statsCases/optimize-chunks/circular2.js 1:0-79 diff --git a/test/statsCases/preset-verbose/expected.txt b/test/statsCases/preset-verbose/expected.txt index 650ebc808..66f9a34dd 100644 --- a/test/statsCases/preset-verbose/expected.txt +++ b/test/statsCases/preset-verbose/expected.txt @@ -2,9 +2,9 @@ Hash: 8ca45b6d16d1f1e8be32 Time: Xms Asset Size Chunks Chunk Names main.js 5.28 kB 0 [emitted] main - 1.js 252 bytes 1 [emitted] - 2.js 107 bytes 2 [emitted] - 3.js 202 bytes 3 [emitted] + 1.js 251 bytes 1 [emitted] + 2.js 106 bytes 2 [emitted] + 3.js 200 bytes 3 [emitted] chunk {0} main.js (main) 73 bytes [rendered] [0] (webpack)/test/statsCases/preset-verbose/a.js 22 bytes {0} [built] cjs require ./a [5] (webpack)/test/statsCases/preset-verbose/index.js 1:0-14