fix(assets): use random hash for atlas
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import { defineNuxtModule, useLogger } from "@nuxt/kit";
|
import { defineNuxtModule, useLogger } from "@nuxt/kit";
|
||||||
import { createHash } from "crypto";
|
|
||||||
import { readdir, readFile, writeFile } from "fs/promises";
|
import { readdir, readFile, writeFile } from "fs/promises";
|
||||||
import { join, relative, parse } from "path";
|
import { join, relative, parse } from "path";
|
||||||
import { existsSync, watch } from "fs";
|
import { existsSync, watch } from "fs";
|
||||||
@@ -300,11 +299,7 @@ ${sp} }`;
|
|||||||
{ stdio: "pipe" },
|
{ stdio: "pipe" },
|
||||||
);
|
);
|
||||||
|
|
||||||
const finalAtlas = await readFile(atlasOutputPath);
|
atlasHash = Math.random().toString(36).slice(2, 10);
|
||||||
atlasHash = createHash("md5")
|
|
||||||
.update(finalAtlas)
|
|
||||||
.digest("hex")
|
|
||||||
.slice(0, 8);
|
|
||||||
|
|
||||||
const imageTree = buildImageTree(imagePaths, rects);
|
const imageTree = buildImageTree(imagePaths, rects);
|
||||||
imageCode = generateImageCode(imageTree);
|
imageCode = generateImageCode(imageTree);
|
||||||
|
|||||||
Reference in New Issue
Block a user