mirror of https://github.com/webpack/webpack.git
21 lines
812 B
JavaScript
21 lines
812 B
JavaScript
// Chunked File Libary
|
|
window.test(window.writing, "Lib2 Should be in first tick");
|
|
var asnycOk = false, asnycOk2 = false;
|
|
require.ensure("./extra", function(require) {
|
|
asnycOk = true;
|
|
window.test(!window.writing, "Lib2 Should be asynchron loaded");
|
|
var sameTick = true;
|
|
require.ensure([], function(require) {
|
|
asnycOk2 = true;
|
|
window.test(require("./extra") === "Lib2 extra", "Lib2 extra loaded");
|
|
window.test(sameTick, "Lib2 Should be in the same tick, as it is a empty chunk");
|
|
});
|
|
sameTick = false;
|
|
});
|
|
setTimeout(function() {
|
|
window.test(asnycOk, "Lib2 Chunk 1 should be loaded");
|
|
window.test(asnycOk2, "Lib2 Chunk 2 should be loaded");
|
|
}, 3000);
|
|
window.test(!asnycOk, "Lib2 Chunk 1 should not be loaded yet");
|
|
window.test(!asnycOk2, "Lib2 Chunk 2 should not be loaded yet");
|
|
exports.ok = true; |