JezerM/nody-greeter

got 3 error when running

Closed this issue · 1 comments

i got 3 error in preloader.ts, i can't give you the error message but i can point out what is the cause.

first thing is you need to remember that preload script in electron is running in renderer process not in main process, but your tsconfig tell otherwise. you need to change the way you access global variable

first error appear here

window.dispatchEvent(_ready_event);

this _ready_event won't work because after being compiled it will use the wrong global variable.

if you see the compiled version it would be like below

window.addEventListener("DOMContentLoaded", () => {
    setTimeout(() => {
        window.dispatchEvent(exports._ready_event);
    }, 2);
});

it reference to a wrong global variable exports instead of globalThis, global or window. this is caused by your tsconfig moduleResolution that tells the typescript compiler to assume that it was a node module

the same apply with 2 other error

let config = greeter_config.greeter;

let config = greeter_config.greeter;

I understand your point, and I'll fix it, but... could you provide the error logs? It would be very helpful~