Skip to content

Commit

Permalink
Fix the issue where wrong cache revisions are generated.
Browse files Browse the repository at this point in the history
  • Loading branch information
okaxaki committed Jun 14, 2024
1 parent 2b9f0fe commit 6e163ef
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fs from "fs";
import path from "path";
import WorkerUrlPlugin from "worker-url/plugin.js";
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
Expand All @@ -9,7 +10,10 @@ const __dirname = path.dirname(new URL(import.meta.url).pathname);
const outputPath = path.resolve(__dirname, "public");
const cacheId = "msxplay";

const getRevision = (file) => crypto.createHash("md5").update(Buffer.from(file)).digest("hex");
const getRevision = (file) => {
const buffer = fs.readFileSync(file);
return crypto.createHash("md5").update(buffer).digest("hex");
}
const getManifestEntry = (file) => {
return {
url: path.relative(outputPath, file),
Expand Down

0 comments on commit 6e163ef

Please sign in to comment.