UNPKG

timpla

Version:

An optimal website development experience for [server-side] web frameworks.

41 lines 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var log = require("fancy-log"); var webpack = require("webpack"); var internal_1 = require("../internal"); exports.webpackProduction = function (timplaConfig) { return function (callback) { var config = internal_1.webpackMultiConfig(timplaConfig)('production'); var handleWebpack = function (err, stats) { internal_1.logTitle('Webpack Stats'); if (err) { log.error(err.stack || err); if (err.details) { log.error(err.details); } } if (stats) { if (stats.hasErrors()) { var errs = stats.toString({ all: false, colors: true, errors: true, }); log.error(errs); } if (stats.hasWarnings()) { var info = stats.toJson(); log.warn(info.warnings); } } if (err || (stats && stats.hasErrors())) { process.exit(1); } if (stats) { var statsMsg = stats.toString({ colors: true, context: internal_1.TIMPLA_PROCESS.INIT_CWD }); console.log(statsMsg); } callback(); }; webpack(config, handleWebpack); }; }; //# sourceMappingURL=webpackProduction.js.map