diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index d2bfca66699..6956609da92 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -12,4 +12,4 @@ **If this is a feature request, what is motivation or use case for changing the behavior?** -**Please mention other relevant information such as the browser version, Node.js version, Operating System and programming language.** +**Please paste the results of `webpack-cli info` here, and mention other relevant information such as programming language.** diff --git a/bin/webpack.js b/bin/webpack.js index 7c6262e8574..1f66df71a80 100755 --- a/bin/webpack.js +++ b/bin/webpack.js @@ -30,7 +30,8 @@ */ "serve", "generate-loader", - "generate-plugin" + "generate-plugin", + "info" ]; const NON_COMPILATION_CMD = process.argv.find(arg => { diff --git a/lib/commands/info.js b/lib/commands/info.js new file mode 100644 index 00000000000..a7c411f743f --- /dev/null +++ b/lib/commands/info.js @@ -0,0 +1,19 @@ +"use strict"; + +const envinfo = require("envinfo"); + +/** + * Prints debugging information for webpack issue reporting + */ + +module.exports = function info() { + console.log( + envinfo.run({ + System: ["OS", "CPU"], + Binaries: ["Node", "Yarn", "npm"], + Browsers: ["Chrome", "Firefox", "Safari"], + npmPackages: "*webpack*", + npmGlobalPackages: ["webpack", "webpack-cli"], + }) + ); +}; diff --git a/lib/index.js b/lib/index.js index 51726c7079c..93ebbe5c502 100644 --- a/lib/index.js +++ b/lib/index.js @@ -53,6 +53,9 @@ module.exports = function initialize(command, args) { case "generate-plugin": { return require("./generate-plugin/index.js")(); } + case "info": { + return require("./commands/info.js")(); + } default: { throw new Error(`Unknown command ${command} found`); } diff --git a/package-lock.json b/package-lock.json index f87ee6451d3..49be9725551 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4356,6 +4356,11 @@ "tapable": "1.0.0" } }, + "envinfo": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-4.4.2.tgz", + "integrity": "sha512-5rfRs+m+6pwoKRCFqpsA5+qsLngFms1aWPrxfKbrObCzQaPc3M3yPloZx+BL9UE3dK58cxw36XVQbFRSCCfGSQ==" + }, "errno": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", diff --git a/package.json b/package.json index 800be894d8b..9699ba08585 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "cross-spawn": "^6.0.5", "diff": "^3.5.0", "enhanced-resolve": "^4.0.0", + "envinfo": "^4.4.2", "glob-all": "^3.1.0", "global-modules": "^1.0.0", "got": "^8.2.0",