🎥 Make videos programmatically with React
make output more minimal when running server
Jonny Burgerb4d3913a0ca8
diff --git a/packages/cli/src/preview-server/dev-middleware/setup-hooks.ts b/packages/cli/src/preview-server/dev-middleware/setup-hooks.tsindex 5ed7edfd08..a0b0166d22 100644--- a/packages/cli/src/preview-server/dev-middleware/setup-hooks.ts+++ b/packages/cli/src/preview-server/dev-middleware/setup-hooks.ts@@ -1,5 +1,6 @@import type {webpack} from '@remotion/bundler';import {Log} from '../../log';+import {truthy} from '../../truthy';import {isColorSupported} from './is-color-supported';import type {DevMiddlewareContext} from './types';@@ -25,16 +26,28 @@ export function setupHooks(context: DevMiddlewareContext) {logger.log('Compilation finished');- const statsOptions = {- preset: 'normal',+ const statsOptions: webpack.Configuration['stats'] = {+ preset: 'errors-warnings',colors: isColorSupported,};const printedStats = stats.toString(statsOptions);- // Avoid extra empty line when `stats: 'none'`- if (printedStats) {- Log.info(printedStats);+ const lines = printedStats+ .split('\n')+ .map((a) => a.trimEnd())+ .filter(truthy)+ .map((a) => {+ if (a.startsWith('webpack compiled')) {+ return `Built in ${stats.endTime - stats.startTime}ms`;+ }++ return a;+ })+ .join('\n');++ if (lines) {+ Log.info(lines);}context.callbacks = [];diff --git a/packages/cli/src/preview-server/hot-middleware/index.tsx b/packages/cli/src/preview-server/hot-middleware/index.tsxindex 8b7013f380..4f7253945f 100644--- a/packages/cli/src/preview-server/hot-middleware/index.tsx+++ b/packages/cli/src/preview-server/hot-middleware/index.tsx@@ -8,13 +8,8 @@ import type {webpack} from '@remotion/bundler';import type {IncomingMessage, ServerResponse} from 'http';import {parse} from 'url';import {Log} from '../../log';-import type {- HotMiddlewareMessage,- ModuleMap,- WebpackStats} from './types';-import {- hotMiddlewareOptions-} from './types';+import type {HotMiddlewareMessage, ModuleMap, WebpackStats} from './types';+import {hotMiddlewareOptions} from './types';const pathMatch = function (url: string, path: string) {try {@@ -35,7 +30,7 @@ export const webpackHotMiddleware = (compiler: webpack.Compiler) => {function onInvalid() {latestStats = null;- Log.info('webpack building...');+ Log.info('Building...');eventStream?.publish({action: 'building',});@@ -143,8 +138,6 @@ function publishStats(name = statsResult.compilation.name || '';}- Log.info(`webpack built in ${_stats.time}ms`);-eventStream?.publish({name,action,