mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
00fb4d1af7
- crypto → node:crypto - fs → node:fs - fs/promises → node:fs/promises - path → node:path - http → node:http - https → node:https - stream → node:stream - buffer → node:buffer - url → node:url - os → node:os - net → node:net - dns → node:dns - events → node:events - readline → node:readline - querystring → node:querystring - util → node:util
31 lines
731 B
TypeScript
31 lines
731 B
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import Logger from "@server/logging/Logger";
|
|
|
|
export type Chunk = {
|
|
file: string;
|
|
imports: string[];
|
|
src: string;
|
|
isEntry?: boolean;
|
|
};
|
|
|
|
export type ManifestStructure = Record<string, Chunk>;
|
|
|
|
export const readManifestFile = (file = "./build/app/.vite/manifest.json") => {
|
|
const absoluteFilePath = path.resolve(file);
|
|
|
|
let manifest = "{}";
|
|
|
|
try {
|
|
manifest = fs.readFileSync(absoluteFilePath, "utf8") as string;
|
|
} catch (_err) {
|
|
Logger.warn(
|
|
`Can not find ${absoluteFilePath}. Try executing "yarn vite:build" before running in production mode.`
|
|
);
|
|
}
|
|
|
|
return JSON.parse(manifest) as ManifestStructure;
|
|
};
|
|
|
|
export default readManifestFile;
|