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

feat: add webpack stats debug output #81

Merged
merged 1 commit into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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