Open cezarsmpio opened 6 years ago
same issue.. I'm not sure what's going on but this is the main issue I keep running into.
Right now this issue is forcing me to integrate Typescript with Electron by hand. Has anyone solved this yet? Or are there any other active projects that integrate Typescript into Electron?
Check out my config here:
https://github.com/burtonator/polar-bookshelf
What I'm doing is loading the main app via require() and then I load the .js files from the filesystem. They HAVE to be loaded via require though or it won't work.
It's really confusing to setup and honestly I kind of just got lucky. This way you don't need to use webpack or babel or anything. I'm just using the standard typescript setup.
When you include your main file like this:
<script src="./main.js">
instead of:
<script>
// https://github.com/electron/electron/issues/2863
require('./index.js');
</script>
The script will run in a browser context, and node variables like exports
will not be available. You will run into a similar situation if you disable nodeIntegration
when you create the window. Your options are:
web
or electron-renderer
)
I've created a single file called configs.ts and my main.ts are importing some third-party libraries and this file. My console is showing to me the following error:
On my HTML, I'm calling the file directly:
My configs.ts:
and my libs:
Am I doing something wrong?
Thanks!