Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describeServeBuilder(executeDevServer, DEV_SERVER_BUILDER_INFO, (harness, setupT

expect(result?.success).toBeTrue();
expect(await response?.text()).toContain(javascriptFileContent);
expect(response?.headers.get('ETag')).toMatch(/^W\/"[^"]+"$/);
Comment thread
MeAkib marked this conversation as resolved.
});

it('serves a project JavaScript asset unmodified', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function createAngularAssetsMiddleware(
// This is a workaround to serve extensionless, CSS, JS and TS files without Vite transformations.
if (!extension || JS_TS_REGEXP.test(extension) || CSS_PREPROCESSOR_REGEXP.test(extension)) {
const contents = readFileSync(asset.source);
const etag = `W/${calculateHash(contents)}`;
const etag = `W/"${calculateHash(contents)}"`;
if (checkAndHandleEtag(req, res, etag)) {
return;
}
Expand Down Expand Up @@ -238,7 +238,7 @@ export function createBuildAssetsMiddleware(
const contents =
outputFile.origin === 'memory' ? outputFile.contents : readHandler(outputFile.source);

const etag = `W/${calculateHash(contents)}`;
const etag = `W/"${calculateHash(contents)}"`;
if (checkAndHandleEtag(req, res, etag)) {
return;
}
Expand Down
Loading