hi-sass-frame/.electron-vite/plugin/vite-ikaros-tools.ts
2024-09-08 23:46:15 +08:00

18 lines
462 B
TypeScript

import { ResolvedConfig } from "vite";
export default () => {
let command = "";
return {
name: "ikaros-tools",
configResolved(resolvedConfig: ResolvedConfig) {
command = resolvedConfig.command;
},
buildStart: () => {
if (command.includes("serve")) {
globalThis.__name = (target: string, value: Record<string, any>) =>
Object.defineProperty(target, "name", { value, configurable: true });
}
},
};
};