Skip to content

Commit 80fca63

Browse files
committed
hide runtime in examples by default
1 parent 2432f5a commit 80fca63

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

examples/build-common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var fs = require("fs");
99
var extraArgs = "";
1010

1111
var targetArgs = global.NO_TARGET_ARGS ? "" : " ./example.js js/output.js";
12-
var displayReasons = global.NO_REASONS ? "" : " --display-reasons --display-used-exports";
12+
var displayReasons = global.NO_REASONS ? "" : " --display-reasons --display-used-exports --display-provided-exports";
1313
(function doIt(remainingTimes) {
1414
cp.exec("node ../../bin/webpack.js" + displayReasons + " --display-chunks --display-modules --display-origins --display-entrypoints --output-public-path \"js/\" -p " + extraArgs + targetArgs, function (error, stdout, stderr) {
1515
if(stderr && remainingTimes === 1)

examples/template-common.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ function lessStrict(regExpStr) {
1212
return regExpStr;
1313
}
1414

15+
var runtimeRegexp = /(```\s*(?:js|javascript)\n)(\/\*\*\*\*\*\*\/ \(function\(modules\) \{ \/\/ webpackBootstrap\n(?:.|\n)*\n\/\*\*\*\*\*\*\/ \}\)\n\/\**\/\n)/;
16+
1517
module.exports = function(template, baseDir, stdout, prefix) {
1618

1719
var regexp = new RegExp("\\{\\{" + (prefix ? prefix+":" : "") + "([^:\\}]+)\\}\\}", "g")
@@ -30,6 +32,14 @@ module.exports = function(template, baseDir, stdout, prefix) {
3032
if(match === "stdout")
3133
return stdout;
3234
return fs.readFileSync(path.join(baseDir, match), "utf-8").replace(/[\r\n]*$/, "");
33-
}).replace(cwd, ".").replace(webpack, "(webpack)").replace(webpackParent, "(webpack)/~");
35+
})
36+
.replace(/\r\n/g, "\n")
37+
.replace(cwd, ".")
38+
.replace(webpack, "(webpack)")
39+
.replace(webpackParent, "(webpack)/~")
40+
.replace(runtimeRegexp, function(match) {
41+
match = runtimeRegexp.exec(match);
42+
return "<details><summary>`/******/ (function(modules) { /* webpackBootstrap */ })`</summary>\n" + match[1] + match[2] + "```\n</details>\n" + match[1];
43+
});
3444

3545
}

0 commit comments

Comments
 (0)