chore: assets output in build (#59)

This commit is contained in:
ClarkXia 2022-03-30 16:41:11 +08:00
parent 6b5d56bc15
commit 3a579259e4
2 changed files with 14 additions and 14 deletions

View File

@ -44,6 +44,19 @@ async function webpackCompiler(options: {
});
const messages = formatWebpackMessages(statsData);
const isSuccessful = !messages.errors.length && !messages.warnings.length;
if (isSuccessful && !process.env.DISABLE_STATS) {
const assetsStatsOptions = {
errors: false,
warnings: false,
colors: true,
assets: true,
chunks: false,
entrypoints: false,
modules: false,
timings: false,
};
consola.log(stats.toString(assetsStatsOptions));
}
if (messages.errors.length) {
// Only keep the first error. Others are often indicative
// of the same problem, but confuse the reader with noise.

View File

@ -49,22 +49,9 @@ const plugin: Plugin = ({ registerTask, context, onHook, registerCliOption, regi
});
});
onHook('after.start.compile', ({ urls, stats, messages }) => {
onHook('after.start.compile', ({ urls, messages }) => {
// 包含错误时不打印 localUrl 和 assets 信息
if (!messages.errors.length) {
if (!commandArgs.disableAssets) {
console.log(stats.toString({
errors: false,
warnings: false,
colors: true,
assets: true,
chunks: false,
entrypoints: false,
modules: false,
timings: false,
}));
}
console.log();
console.log(chalk.green(' Starting the development server at:'));
if (process.env.CLOUDIDE_ENV) {