Skip to content

Commit d242486

Browse files
committed
preivew: only use content hash for text files
1 parent 6358728 commit d242486

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/project/serve/render.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { isAbsolute, join } from "path/mod.ts";
33
import { RenderResult } from "../../command/render/types.ts";
44
import { md5Hash } from "../../core/hash.ts";
55
import { isJupyterNotebook } from "../../core/jupyter/jupyter.ts";
6+
import { isHtmlContent } from "../../core/mime.ts";
67
import { PromiseQueue } from "../../core/promise.ts";
78
import { projectOutputDir } from "../project-shared.ts";
89
import { ProjectContext } from "../types.ts";
@@ -74,8 +75,9 @@ export class ServeRenderManager {
7475
}, "");
7576
// very large jupyter notebooks can take a long time to hash
7677
// (~ 2 seconds for every 10mb) so we use the slightly less
77-
// robust file modification time in that case
78-
if (isJupyterNotebook(inputFile)) {
78+
// robust file modification time in that case. non-html
79+
// content also shouldn't be read with readTextFileSync
80+
if (isJupyterNotebook(inputFile) || !isHtmlContent(file)) {
7981
return String(Deno.statSync(file).mtime) +
8082
String(Deno.statSync(inputFile).mtime) +
8183
resourceHash;

0 commit comments

Comments
 (0)