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

Commit

Permalink
feat: add webpack stats debug output (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed May 7, 2020
1 parent 9e80faf commit e69eb84
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,21 @@ module.exports = (on) => {
}
```

## Debugging

You can see debug messages from this module by running with environment variable

```
DEBUG=cypress:webpack
```

You can see Webpack bundle diagnostic output (timings, chunks, sizes) by running with environment variable

```
DEBUG=cypress:webpack:stats
```
![Webpack stats](images/webpack-stats.png)

## Contributing

Use the [version of Node that matches Cypress](https://github.com/cypress-io/cypress/blob/develop/.node-version).
Expand Down
Binary file added images/webpack-stats.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path')
const webpack = require('webpack')
const debug = require('debug')('cypress:webpack')
const debugStats = require('debug')('cypress:webpack:stats')

const createDeferred = require('./deferred')
const stubbableRequire = require('./stubbable-require')
Expand Down Expand Up @@ -149,6 +150,11 @@ const preprocessor = (options = {}) => {
}

debug('finished bundling', outputPath)
if (debugStats.enabled) {
/* eslint-disable-next-line no-console */
console.error(stats.toString({ colors: true }))
}

// resolve with the outputPath so Cypress knows where to serve
// the file from
latestBundle.resolve(outputPath)
Expand Down

0 comments on commit e69eb84

Please sign in to comment.