diff --git a/e2e/cases/config/stats-module-trace/index.test.ts b/e2e/cases/config/stats-module-trace/index.test.ts index e49bd92b47..33946d40c2 100644 --- a/e2e/cases/config/stats-module-trace/index.test.ts +++ b/e2e/cases/config/stats-module-trace/index.test.ts @@ -1,7 +1,7 @@ import { build, proxyConsole } from '@e2e/helper'; import { expect, test } from '@playwright/test'; -test('should log error module trace when enable moduleTrace', async () => { +test('should log error module trace', async () => { const { restore, logs } = proxyConsole(); await expect( diff --git a/e2e/cases/config/stats-module-trace/rsbuild.config.ts b/e2e/cases/config/stats-module-trace/rsbuild.config.ts deleted file mode 100644 index 0a00f8dac1..0000000000 --- a/e2e/cases/config/stats-module-trace/rsbuild.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -export default { - tools: { - rspack: { - stats: { - moduleTrace: true, - }, - }, - webpack: { - stats: { - moduleTrace: true, - }, - }, - }, -}; diff --git a/packages/compat/webpack/package.json b/packages/compat/webpack/package.json index 6ec392e69a..490c9aa6a7 100644 --- a/packages/compat/webpack/package.json +++ b/packages/compat/webpack/package.json @@ -45,7 +45,7 @@ "typescript": "^5.6.3" }, "peerDependencies": { - "@rsbuild/core": "^1.1.2" + "@rsbuild/core": "^1.1.3" }, "publishConfig": { "access": "public", diff --git a/packages/compat/webpack/src/createCompiler.ts b/packages/compat/webpack/src/createCompiler.ts index f5b65a1b3d..7d5e6a0ac0 100644 --- a/packages/compat/webpack/src/createCompiler.ts +++ b/packages/compat/webpack/src/createCompiler.ts @@ -23,11 +23,10 @@ export async function createCompiler(options: InitConfigsOptions) { const done = (stats: Rspack.Stats) => { const statsOptions = helpers.getStatsOptions(compiler); const statsJson = stats.toJson({ + moduleTrace: true, children: true, - ...(typeof statsOptions === 'string' - ? { preset: statsOptions } - : { preset: 'errors-warnings' }), - ...(typeof statsOptions === 'object' ? statsOptions : {}), + preset: 'errors-warnings', + ...statsOptions, }); const { message, level } = helpers.formatStats( diff --git a/packages/core/src/provider/createCompiler.ts b/packages/core/src/provider/createCompiler.ts index ab75ac3d14..1ffb4cb456 100644 --- a/packages/core/src/provider/createCompiler.ts +++ b/packages/core/src/provider/createCompiler.ts @@ -65,6 +65,7 @@ export async function createCompiler(options: InitConfigsOptions): Promise<{ const statsOptions = getStatsOptions(compiler); const statsJson = stats.toJson({ children: true, + moduleTrace: true, // get the compilation time timings: true, preset: 'errors-warnings', diff --git a/packages/core/src/server/socketServer.ts b/packages/core/src/server/socketServer.ts index 5ac4a5b174..ed06152d54 100644 --- a/packages/core/src/server/socketServer.ts +++ b/packages/core/src/server/socketServer.ts @@ -205,6 +205,7 @@ export class SocketServer { errorDetails: false, entrypoints: true, children: true, + moduleTrace: true, }; const statsOptions = getStatsOptions(curStats.compilation.compiler);