restify-webpack-middleware

0.0.9 • Public • Published

Restify Webpack Middleware

Just a thin wrapper around Webpack Dev Middleware and Webpack Hot Middleware for use with Restify.

registerWebpackMiddleware()

registerWebpackMiddleware(restifyInstance, { compiler, webpackDevConfig, webpackHotConfig });

Pass the instance of your Restify server along with the compiled Webpack config and the standard configuration objects from both Dev and Hot Middlewares and presto/chango/whamo you'll have some hot-dev middleware action.

import restify from 'restify';
import webpack from 'webpack';
import registerWebpackMiddleware from 'restify-webpack-middleware';

import webpackConfig from './path/to/your/webpack.config';

const server = restify.createServer({ ... });

const compiler = webpack(webpackConfig);

const webpackDevConfig = {
  webpackConfig,
  publicPath: webpackConfig.output.publicPath,
};

const webpackHotConfig = {
  log: console.log,
  path: '/__webpack_hmr',
};

registerWebpackMiddleware(
  restifyApp,
  {
    compiler,
    webpackDevConfig,
    webpackHotConfig,
  }
);

Package Sidebar

Install

npm i restify-webpack-middleware

Weekly Downloads

0

Version

0.0.9

License

ISC

Last publish

Collaborators

  • cpeddecord