Skip to content

Commit 8f54cbc

Browse files
committed
Merge branch 'iotch-patch-1'
2 parents 68b80bd + bc926ca commit 8f54cbc

File tree

7 files changed

+19
-12
lines changed

7 files changed

+19
-12
lines changed

lib/MainTemplate.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ function MainTemplate(outputOptions) {
7474
"exports: {}"
7575
]);
7676
});
77-
this.plugin("require-extensions", function(source, chunk) {
78-
if(chunk.chunks.length === 0) return source;
79-
return this.asString([
80-
source,
81-
"",
82-
"// on error function for async loading",
83-
this.requireFn + ".oe = function(err) { console.error(err); throw err; };"
84-
]);
85-
});
8677
this.plugin("require-extensions", function(source, chunk, hash) {
8778
var buf = [];
8879
if(chunk.chunks.length > 0) {
@@ -108,6 +99,15 @@ function MainTemplate(outputOptions) {
10899
buf.push(this.requireFn + ".p = " + JSON.stringify(publicPath) + ";");
109100
return this.asString(buf);
110101
});
102+
this.plugin("require-extensions", function(source, chunk) {
103+
if(chunk.chunks.length === 0) return source;
104+
return this.asString([
105+
source,
106+
"",
107+
"// on error function for async loading",
108+
this.requireFn + ".oe = function(err) { console.error(err); throw err; };"
109+
]);
110+
});
111111
}
112112
module.exports = MainTemplate;
113113

test/cases/runtime/issue-2391-chunk/file.js

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
it("should have a require.onError function by default", function() {
2+
(typeof require.onError).should.be.eql("function");
3+
require(["./file"]);
4+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
it("should not have a require.onError function by default", function() {
2+
(typeof require.onError).should.be.eql("undefined");
3+
});

test/statsCases/chunks/expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Hash: 55b4e00b04fd0c502b1f
22
Time: Xms
33
Asset Size Chunks Chunk Names
4-
bundle.js 4.41 kB 0 [emitted] main
4+
bundle.js 4.55 kB 0 [emitted] main
55
1.bundle.js 250 bytes 1 [emitted]
66
2.bundle.js 107 bytes 2 [emitted]
77
3.bundle.js 202 bytes 3 [emitted]

test/statsCases/optimize-chunks/expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Time: Xms
44
0.js 243 bytes 0 [emitted] cir1
55
1.js 215 bytes 1, 2 [emitted] abd
66
2.js 131 bytes 2 [emitted] ab
7-
main.js 5.13 kB 3 [emitted] main
7+
main.js 5.27 kB 3 [emitted] main
88
4.js 258 bytes 4 [emitted] cir2
99
5.js 138 bytes 5, 7 [emitted] chunk
1010
6.js 317 bytes 6, 4 [emitted] cir2 from cir1

test/statsCases/preset-verbose/expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Hash: 8ca45b6d16d1f1e8be32
22
Time: Xms
33
Asset Size Chunks Chunk Names
4-
main.js 4.41 kB 0 [emitted] main
4+
main.js 4.54 kB 0 [emitted] main
55
1.js 250 bytes 1 [emitted]
66
2.js 107 bytes 2 [emitted]
77
3.js 202 bytes 3 [emitted]

0 commit comments

Comments
 (0)