Can anyone solve the error:

__vite-browser-external:3 Uncaught Error: Module "" has been externalized for browser compatibility. Cannot access ".readFileSync" in client code.

For the following code:

export async function loadXliff(src: string): Promise<XliffFile> {
    const xliff = readFileSync(src);
    return xliff12ToJs(xliff.toString());
}

I tried FiLeReader API, it ain't working. I also tried importing fs, still not working, its showing fs is unidentified.

Tried importing all the related imports, still does not work

0

There are 0 best solutions below