Skip to content

Commit d9509e8

Browse files
committed
add publicPath to stats
1 parent 68cf311 commit d9509e8

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

lib/MainTemplate.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ function MainTemplate(outputOptions) {
8383
buf.push("// expose the module cache");
8484
buf.push(this.requireFn + ".c = installedModules;");
8585

86-
var publicPath = this.outputOptions.publicPath || "";
87-
publicPath = this.applyPluginsWaterfall("asset-path", publicPath, {
86+
var publicPath = this.getPublicPath({
8887
hash: hash
8988
});
9089
buf.push("");
@@ -145,6 +144,10 @@ MainTemplate.prototype.entryPointInChildren = function(chunk) {
145144
}(chunk, []));
146145
};
147146

147+
MainTemplate.prototype.getPublicPath = function(options) {
148+
return this.applyPluginsWaterfall("asset-path", this.outputOptions.publicPath || "", options);
149+
};
150+
148151
MainTemplate.prototype.updateHash = function(hash) {
149152
hash.update("maintemplate");
150153
hash.update("3");

lib/Stats.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Stats.prototype.toJson = function toJson(options, forToString) {
3737
var showChildren = d(options.children, true);
3838
var showSource = d(options.source, !forToString);
3939
var showErrorDetails = d(options.errorDetails, !forToString);
40+
var showPublicPath = d(options.publicPath, !forToString);
4041
var excludeModules = [].concat(d(options.exclude, [])).map(function(str) {
4142
if(typeof str !== "string") return str;
4243
return new RegExp("[\\\\/]" + str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "([\\\\/]|$|!|\\?)");
@@ -108,6 +109,11 @@ Stats.prototype.toJson = function toJson(options, forToString) {
108109
if(showTimings && this.startTime && this.endTime) {
109110
obj.time = this.endTime - this.startTime;
110111
}
112+
if(showPublicPath) {
113+
obj.publicPath = this.compilation.mainTemplate.getPublicPath({
114+
hash: this.compilation.renderedHash
115+
});
116+
}
111117
if(showAssets) {
112118
var assetsByFile = {};
113119
obj.assetsByChunkName = {};
@@ -365,6 +371,11 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
365371
normal("ms");
366372
newline();
367373
}
374+
if(obj.publicPath) {
375+
normal("PublicPath: ")
376+
bold(obj.publicPath);
377+
newline();
378+
}
368379
if(obj.assets && obj.assets.length > 0) {
369380
var t = [["Asset", "Size", "Chunks", "", "Chunk Names"]]
370381
obj.assets.forEach(function(asset) {

0 commit comments

Comments
 (0)