ffbt
Version:
Build a Typescript app without pain
37 lines (36 loc) • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const default_1 = require("../../../../project-config/default");
// https://webpack.js.org/configuration/stats/#stats
const webpackLoggingConfigs = {
[default_1.OutputStatsStyles.minimal]: "minimal",
[default_1.OutputStatsStyles.normal]: {
logging: "info",
colors: true,
warnings: true,
},
[default_1.OutputStatsStyles.verbose]: {
logging: "verbose",
loggingTrace: true,
colors: true,
loggingDebug: [
() => true
],
}
};
function getStatsLoggingConfig(projectConfig) {
const presetName = projectConfig.env.verboseMode
? default_1.OutputStatsStyles.verbose
: projectConfig.env.buildStatsStyle;
const loggingConfig = webpackLoggingConfigs[presetName];
if (!loggingConfig) {
throw new Error(`Can't find stats logging preset with name ${presetName}`);
}
return loggingConfig;
}
const layer = (projectConfig) => {
return {
stats: getStatsLoggingConfig(projectConfig),
};
};
module.exports = layer;