webpack-dev-stats-viewer-middleware

1.0.0 • Public • Published

webpack-dev-stats-viewer-middleware

Stats viewer for webpack-dev-middleware

Usage

This works in conjuction with (webpack-dev-middleware)[https://github.com/webpack/webpack-dev-middleware] to enable viewing the raw stats generated by the server.

The statsViewer sets itself up, by accepting the following parameters:

  • expressApp - the app created by express()
  • url - the url to respond to (this must be a url under the webpack middleware's path)

The url must be under the webpack path, because webpack adds the stats object before passing the request on. For that to work, webpack-dev-middleware must receive a parameter, serverSideRender: true.

Example

// External requirements
const express = require('express');
const webpack = require('webpack');
const webpackMiddleware = require('webpack-dev-middleware');
const statsViewer = require('webpack-dev-stats-viewer-middleware');

// Setup
const expressApp = express();

// Client-side applications
const app = require('../app-definition');

// Webpack Dev Middleware
expressApp.use('/dev-server/', webpackMiddleware(webpack(app), {
    serverSideRender: true
});
// Stats viewer
statsViewer(expressApp, '/dev-server/stats');

// HTTPS Setup
expressApp.listen(8080);

Readme

Keywords

none

Package Sidebar

Install

npm i webpack-dev-stats-viewer-middleware

Weekly Downloads

9

Version

1.0.0

License

MIT

Last publish

Collaborators

  • configurator