better way to bootstrap entry splits

now you can use multiple entry points on one page, when using a commons chunk.

entry splits are entry points that are rendered as chunk because a commons chunk is used
This commit is contained in:
Tobias Koppers 2013-12-19 23:22:36 +01:00
parent 776eabc6f1
commit b9ce650150
2 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,8 @@
<html>
<head></head>
<body>
<script src="js/commons.js" charset="utf-8"></script>
<script src="js/pageA.bundle.js" charset="utf-8"></script>
<script src="js/pageB.bundle.js" charset="utf-8"></script>
</body>
</html>

View File

@ -23,7 +23,6 @@ JsonpMainTemplate.prototype.renderLocalVars = function(hash, chunk) {
'// Array means "loading", array contains callbacks',
"var installedChunks = {",
this.indent(
(chunk.ids.indexOf(0) < 0 ? "0:[function(require){require(0);}],\n" : "") +
chunk.ids.map(function(id) {
return id + ":0"
}).join(",\n")
@ -97,6 +96,14 @@ JsonpMainTemplate.prototype.renderInit = function(hash, chunk) {
"}",
"while(callbacks.length)",
this.indent("callbacks.shift().call(null, " + this.requireFn + ");"),
(chunk.ids.indexOf(0) < 0 ? [
"if(0 in moreModules) {",
this.indent([
"installedModules[0] = 0;",
this.requireFn + "(0);"
]),
"}"
] : "")
]),
"};"
);