mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
18 lines
595 B
TypeScript
18 lines
595 B
TypeScript
/* eslint import/prefer-default-export: off, import/no-mutable-exports: off */
|
|
import { URL } from "url";
|
|
import path from "path";
|
|
|
|
export let resolveHtmlPath: (htmlFileName: string) => string;
|
|
|
|
if (process.env.NODE_ENV === "development") {
|
|
const port = process.env.PORT || 1212;
|
|
resolveHtmlPath = (htmlFileName: string) => {
|
|
const url = new URL(`http://localhost:${port}/${htmlFileName}`);
|
|
return url.toString();
|
|
};
|
|
} else {
|
|
resolveHtmlPath = (htmlFileName: string) => {
|
|
return `file://${path.resolve(__dirname, "../renderer/", htmlFileName)}`;
|
|
};
|
|
}
|