Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit e69eb84

Browse files
authored
feat: add webpack stats debug output (#81)
1 parent 9e80faf commit e69eb84

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,21 @@ module.exports = (on) => {
151151
}
152152
```
153153

154+
## Debugging
155+
156+
You can see debug messages from this module by running with environment variable
157+
158+
```
159+
DEBUG=cypress:webpack
160+
```
161+
162+
You can see Webpack bundle diagnostic output (timings, chunks, sizes) by running with environment variable
163+
164+
```
165+
DEBUG=cypress:webpack:stats
166+
```
167+
![Webpack stats](images/webpack-stats.png)
168+
154169
## Contributing
155170

156171
Use the [version of Node that matches Cypress](https://github.com/cypress-io/cypress/blob/develop/.node-version).

images/webpack-stats.png

338 KB
Loading

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path')
22
const webpack = require('webpack')
33
const debug = require('debug')('cypress:webpack')
4+
const debugStats = require('debug')('cypress:webpack:stats')
45

56
const createDeferred = require('./deferred')
67
const stubbableRequire = require('./stubbable-require')
@@ -149,6 +150,11 @@ const preprocessor = (options = {}) => {
149150
}
150151

151152
debug('finished bundling', outputPath)
153+
if (debugStats.enabled) {
154+
/* eslint-disable-next-line no-console */
155+
console.error(stats.toString({ colors: true }))
156+
}
157+
152158
// resolve with the outputPath so Cypress knows where to serve
153159
// the file from
154160
latestBundle.resolve(outputPath)

0 commit comments

Comments
 (0)