Skip to content

Commit 1199c61

Browse files
authored
Merge branch 'master' into feature/rollup
2 parents 74cdfc5 + 1743e9a commit 1199c61

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

packages/common/src/lib/common.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const getEndpointFromType = (type: string) => {
6565
return {
6666
webpack: process.env.WEBPACK_ENDPOINT || 'http://compilation-metrics/webpack',
6767
vite: process.env.VITE_ENDPOINT || 'http://compilation-metrics/vite',
68+
vitehmr: process.env.VITE_ENDPOINT || 'http://compilation-metrics/vite',
6869
rsbuild: process.env.WEBPACK_ENDPOINT || 'http://compilation-metrics/webpack',
6970
}[type];
7071
};
@@ -102,5 +103,7 @@ export const sendBuildData = async (
102103
return;
103104
}
104105

105-
console.log(`Your build stats has successfully been sent.`);
106+
console.log(
107+
`Your build stats has successfully been sent to ${endpoint} for ${buildStats.type}.`,
108+
);
106109
};

packages/common/src/lib/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export interface ViteBundleStats {
4949
}
5050

5151
export interface ViteBuildData extends CommonMetadata {
52-
type: 'vite';
52+
type: 'vite' | 'vitehmr';
5353
viteVersion: string | null;
5454
bundleStats?: ViteBundleStats;
5555
file: string | null;

packages/vite-plugin/src/lib/vite-build-stats-plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function viteBuildStatsPlugin(
9696

9797
const metricsData: ViteBuildData = {
9898
...getCommonMetadata(totalTime, customIdentifier),
99-
type: 'vite',
99+
type: 'vitehmr',
100100
viteVersion: rollupVersion ?? null,
101101
bundleStats: {
102102
bootstrapChunkSizeBytes: undefined,
@@ -111,7 +111,7 @@ export function viteBuildStatsPlugin(
111111
res.writeHead(200, { 'Content-Type': 'application/json' });
112112
res.end(JSON.stringify({ success: true }));
113113
} else {
114-
res.writeHead(200, { 'Content-Type': 'application/json' });
114+
res.writeHead(404, { 'Content-Type': 'application/json' });
115115
res.end(
116116
JSON.stringify({
117117
success: false,
@@ -123,7 +123,7 @@ export function viteBuildStatsPlugin(
123123
}
124124
} catch (err) {
125125
console.error('[vite-timing] Error processing timing data:', err);
126-
res.writeHead(200, { 'Content-Type': 'application/json' });
126+
res.writeHead(500, { 'Content-Type': 'application/json' });
127127
res.end(
128128
JSON.stringify({
129129
success: false,

0 commit comments

Comments
 (0)