scripts/webpack-dev-hot.js
function webpackDev(app) {

  var { config } = app.locals;

  // configure data-source
  var DataSource = require('loopback-datasource-juggler').DataSource;
  var mainDs = new DataSource(config.db);

  // Enable All CORS Requests
  app.use(cors());

  let sql = "SELECT * FROM zlSite WHERE zsTheme != ''";
  mainDs.connector.execute(sql, [null], function (err, zs) {
    if (err) app.error(err);
    else {
      _.forEach(zs, function(zlSite) {
        // check if we're only working on 1 site
        if (process.env.DEV_SITE && zlSite.zsId !== process.env.DEV_SITE) {
          return;
        }

        // webpack config specific for hot/webpackDevServer
        let hotConf = {
          output: {
            filename: `${zlSite.zsId}/dist/js/[name].js`,
            publicPath: '/',
            path: '/'
          },
          devtool: 'cheap-module-source-map',
          plugins: [
            new ExtractTextPlugin({ filename: `${zlSite.zsId}/dist/css/[name].css` })
          ]
        }

        // make bundle config for site
        readyBundle(app, zlSite, '', '', (wpConfig) => {
          var webpackConfig = merge(common, wpConfig, hotConf);
          var compiler = webpack(webpackConfig);

          app.use(webpackDevMiddleware(compiler, {
            publicPath: "/",
            lazy: false
          }));
        });
      });

      // launch webpack-dev-middleware server
      var port = 3000
      if (config.webpackDevServer && config.webpackDevServer.port) {
        port = config.webpackDevServer.port;
      }
      app.listen(port, function () {
        app.debug('webpackDevMiddleware Listening on port %s!', port)
      });
    }
  });
}
function webpackDev(app) {

  var { config } = app.locals;

  // configure data-source
  var DataSource = require('loopback-datasource-juggler').DataSource;
  var mainDs = new DataSource(config.db);

  // Enable All CORS Requests
  app.use(cors());

  let sql = "SELECT * FROM zlSite WHERE zsTheme != ''";
  mainDs.connector.execute(sql, [null], function (err, zs) {
    if (err) app.error(err);
    else {
      _.forEach(zs, function(zlSite) {
        // check if we're only working on 1 site
        if (process.env.DEV_SITE && zlSite.zsId !== process.env.DEV_SITE) {
          return;
        }

        // webpack config specific for hot/webpackDevServer
        let hotConf = {
          output: {
            filename: `${zlSite.zsId}/dist/js/[name].js`,
            publicPath: '/',
            path: '/'
          },
          devtool: 'cheap-module-source-map',
          plugins: [
            new ExtractTextPlugin({ filename: `${zlSite.zsId}/dist/css/[name].css` })
          ]
        }

        // make bundle config for site
        readyBundle(app, zlSite, '', '', (wpConfig) => {
          var webpackConfig = merge(common, wpConfig, hotConf);
          var compiler = webpack(webpackConfig);

          app.use(webpackDevMiddleware(compiler, {
            publicPath: "/",
            lazy: false
          }));
        });
      });

      // launch webpack-dev-middleware server
      var port = 3000
      if (config.webpackDevServer && config.webpackDevServer.port) {
        port = config.webpackDevServer.port;
      }
      app.listen(port, function () {
        app.debug('webpackDevMiddleware Listening on port %s!', port)
      });
    }
  });
}
dev/bundle only mode