This project aims to enable webpack logging to be surfaced in browser DevTools, through a simple extension for Webpack and/or https://github.com/webpack/webpack-dev-server
- As a developer I can see my Webpack logs and errors in the DevTools console together with the rest of my logs.
Central place for logs and errors regardless if they are client-side, server-side or coming from the build system.
We can leverage the DevTools console standard proposed by https://craig.is/writing/chrome-logger, which enables transfer of server-side logs per request through a custom HTTP response header.
- Attach listener to Webpack stats
- Cache logs per bundle/output file
- On inbound HTTP request for bundle
- Grab cache entries in cache for the requested file
- Serialized through standard, and attach to the file request on
x-chrome-logger
header - Bam!
The console API is already implemented in Node/JS: https://github.com/olahol/express-chrome-logger/blob/master/index.js
My thinking is to simply open a PR to webpack-dev-server with the support, and add a config option, as it seems to be the simplest place to validate the value of this functionality.
Adding support to webpack-dev-middleware, could be valuable too
- Chrome, supports the standard via https://craig.is/writing/chrome-logger
- Firefox, native support in Firefox Developer Edition
- Edge, not supported
- Webkit, not supported.