import express from 'express'
import webpack from 'webpack'

/**
 * Development server
 * @param  {Object} webpackConfig
 * @return express application
 */
export default function (webpackConfig) {
  const app = express()
  const compiler = webpack(webpackConfig)

  app.use(require('webpack-dev-middleware')(compiler, {
    noInfo: true,
    publicPath: webpackConfig.output.publicPath
  }))

  app.use(express.static(webpackConfig.context))
  app.use(require('webpack-hot-middleware')(compiler))

  return app
}

import express from 'express'
import webpack from 'webpack'

/**
 * Development server
 * @param  {Object} webpackConfig
 * @return express application
 */
export default function (webpackConfig) {
  const app = express()
  const compiler = webpack(webpackConfig)

  app.use(require('webpack-dev-middleware')(compiler, {
    noInfo: true
  }))

  app.use(require('webpack-hot-middleware')(compiler))

  return app
}

Make the server work again
Make the server work again

This solution has a slight disadvantage, if running either library or pages, the assets are served in the root, otherwise we get different relative paths based on the output path.