Skip to content

Commit 2d361e9

Browse files
committed
fix(@angular/build): always disable JSON stats with dev-server
When using the development server, the `statsJson` option will now unconditionally be disabled. The output JSON file is not accessible with the server and the analysis/generation of the JSON file may increase the rebuild time. Additionally, the JSON file changes during a rebuild may unexpectedly cause component HMR fallback to a full reload due to non-component file changes in the build output. (cherry picked from commit eb058d0)
1 parent 6020803 commit 2d361e9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/angular/build/src/builders/dev-server/vite-server.ts

+10
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ export async function* serveWithVite(
117117
autoCsp: false,
118118
};
119119

120+
// Disable JSON build stats.
121+
// These are not accessible with the dev server and can cause HMR fallbacks.
122+
if (browserOptions.statsJson === true) {
123+
context.logger.warn(
124+
'Build JSON statistics output (`statsJson` option) has been disabled.' +
125+
' The development server does not support this option.',
126+
);
127+
}
128+
browserOptions.statsJson = false;
129+
120130
// Set all packages as external to support Vite's prebundle caching
121131
browserOptions.externalPackages = serverOptions.prebundle;
122132

0 commit comments

Comments
 (0)