diff --git a/README.md b/README.md index 2840750..129f0cf 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/images/webpack-stats.png b/images/webpack-stats.png new file mode 100644 index 0000000..88f57eb Binary files /dev/null and b/images/webpack-stats.png differ diff --git a/index.js b/index.js index 7104bcf..8e47497 100644 --- a/index.js +++ b/index.js @@ -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') @@ -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)