1.0.0 • Published 7 years ago

webpack-dev-stats-viewer-middleware v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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);
1.0.0

7 years ago