Currently working on a hello world project in Electron and stumbled across the possibility of using Typescript for the Main process, .
The provided instructions suggest changing the file extension from index.js to index.ts and updating the package.json file to point to the new script:
{
"name": "electrontypescript",
"version": "1.0.0",
...
}
Following these steps enabled me to get it up and running, but when I attempted to add my own class, errors started popping up.
The beginning of index.ts looks like this:
const { TypeHouse } = require ("./TypeHouse");
In the TypeHouse.ts file, there's some code defining classes and methods implemented. However, upon execution, an error is thrown stating that it cannot find the module './TypeHouse'.
Moreover, the error message revealed:
App threw an error during load Error: Cannot find module './TypeHouse' Require stack: - /Users/projects/ElectronApp/index.ts - /Users/projects/ElectronApp/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/main.js
It's worth noting that I'm utilizing Visual Studio Code, where the error appears in the console.