scripts/build.js
function bundleServer(app, promises) {
  var { themes, config } = app.locals;

  // iterate all themes
  _.forEach(themes, function(val, theme) {
    promises.push( new Promise(function(resolve) {
      // make bundle config for server-renderer
      readyBundle(app, '', theme, resolve, (wpConfig, sitePath, appBundled, done) => {
        // if wpConfig is empty that means packages was not changed, so skip
        if (!wpConfig) return;

        // Webpack specific for bundled file
        let conf = {
          output: {
            filename: `${config.contentPath}/build/${theme}/server-render.js`
          },
          entry: `${themes[appBundled].path}/${themes[appBundled].zealderConfig.serverRenderFile}`
        };

        var webpackConfig = merge(webpackServer, wpConfig, conf);
        webpack(webpackConfig, (err, stats) => {
          if (err) throw new Error(err.stack || err);
          const info = stats.toJson();
          if (stats.hasErrors()) app.error(info.errors);
          done();
        });
      });
    }));
  });
}
function bundleServer(app, promises) {
  var { themes, config } = app.locals;

  // iterate all themes
  _.forEach(themes, function(val, theme) {
    promises.push( new Promise(function(resolve) {
      // make bundle config for server-renderer
      readyBundle(app, '', theme, resolve, (wpConfig, sitePath, appBundled, done) => {
        // if wpConfig is empty that means packages was not changed, so skip
        if (!wpConfig) return;

        // Webpack specific for bundled file
        let conf = {
          output: {
            filename: `${config.contentPath}/build/${theme}/server-render.js`
          },
          entry: `${themes[appBundled].path}/${themes[appBundled].zealderConfig.serverRenderFile}`
        };

        var webpackConfig = merge(webpackServer, wpConfig, conf);
        webpack(webpackConfig, (err, stats) => {
          if (err) throw new Error(err.stack || err);
          const info = stats.toJson();
          if (stats.hasErrors()) app.error(info.errors);
          done();
        });
      });
    }));
  });
}
function bundleServer ( app , promises ) { var { themes , config } = app . locals ; // iterate all themes _ . forEach ( themes , function ( val , theme ) { promises . push ( new Promise ( function ( resolve ) { // make bundle config for server-renderer readyBundle ( app , '' , theme , resolve , ( wpConfig , sitePath , appBundled , done ) => { // if wpConfig is empty that means packages was not changed, so skip if ( ! wpConfig ) return ; // Webpack specific for bundled file let conf = { output : { filename : ` ${ config . contentPath } ${ theme } ` } , entry : ` ${ themes [ appBundled ] . path } ${ themes [ appBundled ] . zealderConfig . serverRenderFile } ` } ; var webpackConfig = merge ( webpackServer , wpConfig , conf ) ; webpack ( webpackConfig , ( err , stats ) => { if ( err ) throw new Error ( err . stack || err ) ; const info = stats . toJson ( ) ; if ( stats . hasErrors ( ) ) app . error ( info . errors ) ; done ( ) ; } ) ; } ) ; } ) ) ; } ) ; }
make server bundles
make server bundles