Merge pull request #17406 from ersachin3112/stats-minimal

docs: add example for stats minimal output
This commit is contained in:
Sean Larkin 2023-06-21 09:00:48 -07:00 committed by GitHub
commit d1f1433fd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 95 additions and 2 deletions

View File

@ -16,7 +16,8 @@ const targetArgs = global.NO_TARGET_ARGS ? "" : "--entry ./example.js --output-f
const displayReasons = global.NO_REASONS ? "" : "--stats-reasons --stats-used-exports --stats-provided-exports";
const statsArgs = global.NO_STATS_OPTIONS ? "" : "--stats-chunks --stats-modules-space 99999 --stats-chunk-origins";
const publicPathArgs = global.NO_PUBLIC_PATH ? "" : '--output-public-path "dist/"';
const commonArgs = `--no-stats-colors ${statsArgs} ${publicPathArgs} ${extraArgs} ${targetArgs}`;
const statsColorsArg = global.STATS_COLORS ? "" : "--no-stats-colors";
const commonArgs = `${statsColorsArg} ${statsArgs} ${publicPathArgs} ${extraArgs} ${targetArgs}`;
let readme = fs.readFileSync(require("path").join(process.cwd(), "template.md"), "utf-8");

2
examples/node_modules/module.js generated vendored
View File

@ -1 +1 @@
module.exports = "module";
module.exports = "module";

View File

@ -0,0 +1,49 @@
This configuration will enable the minimal output for the stats report.
You see that everything is working nicely together.
# example.js
```javascript
console.log("Hello World!");
```
# webpack.config.js
```javascript
const path = require("path");
module.exports = {
output: {
path: path.join(__dirname, "dist"),
filename: "output.js"
},
stats: "minimal"
};
```
# dist/output.js
```javascript
/******/ (() => { // webpackBootstrap
var __webpack_exports__ = {};
/*!********************!*\
!*** ./example.js ***!
\********************/
/*! unknown exports (runtime-defined) */
/*! runtime requirements: */
console.log("Hello World!");
/******/ })()
;
```
# Info
## Production mode
```
1 asset
1 module
webpack 5.87.0 compiled successfully
```

View File

@ -0,0 +1,4 @@
global.NO_REASONS = true;
global.NO_STATS_OPTIONS = true;
global.STATS_COLORS = true;
require("../build-common");

View File

@ -0,0 +1 @@
console.log("Hello World!");

View File

@ -0,0 +1,29 @@
This configuration will enable the minimal output for the stats report.
You see that everything is working nicely together.
# example.js
```javascript
_{{example.js}}_
```
# webpack.config.js
```javascript
_{{webpack.config.js}}_
```
# dist/output.js
```javascript
_{{dist/output.js}}_
```
# Info
## Production mode
```
_{{production:stdout}}_
```

View File

@ -0,0 +1,9 @@
const path = require("path");
module.exports = {
output: {
path: path.join(__dirname, "dist"),
filename: "output.js"
},
stats: "minimal"
};