mirror of https://github.com/webpack/webpack.git
smaller code splitting for merged chunks
This commit is contained in:
parent
e0a8dbc037
commit
c32b233a4f
|
|
@ -23,8 +23,13 @@ RequireEnsureDependency.Template.prototype.apply = function(dep, source, outputO
|
|||
if(outputOptions.pathinfo) comment = "/*! " + requestShortener.shorten(depBlock.chunkName) + " */ ";
|
||||
source.replace(depBlock.chunkNameRange[0], depBlock.chunkNameRange[1]-1, comment + "0");
|
||||
}
|
||||
if(depBlock.chunk && depBlock.chunk.id) {
|
||||
source.replace(depBlock.expr.callee.range[0], depBlock.expr.callee.range[1]-1, "require.e/*nsure*/");
|
||||
source.replace(depBlock.expr.arguments[0].range[0], depBlock.expr.arguments[0].range[1]-1, (depBlock.chunk && depBlock.chunk.id || 0) + "" + asComment(depBlock.chunkReason));
|
||||
source.replace(depBlock.expr.arguments[0].range[0], depBlock.expr.arguments[0].range[1]-1, (depBlock.chunk.id) + "" + asComment(depBlock.chunkReason));
|
||||
} else {
|
||||
source.replace(depBlock.expr.range[0], depBlock.expr.arguments[1].range[0]-1, "/*require.ensure*/(");
|
||||
source.replace(depBlock.expr.arguments[1].range[1], depBlock.expr.range[1]-1, "(require))");
|
||||
}
|
||||
}
|
||||
|
||||
function asComment(str) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue