How to use TypeScript modules in Electron?


#1

I’ve tried to use tsc-generated modules in Electron (on the renderer side). The compilation goes fine, but on runtime I get “ReferenceError: exports is not defined” error. Does it mean that Electron does not support CommonJS modules in the renderer? What kind of modules does “require” function support on the browser side? How can I use TypeScript modules in Electron?


Importing Typescript modules in the renderer process
#2

Slightly late, but do you have an example? Dabbling in typescript lately, interested in poking at this.


#3

Just joined this group. Not sure why you’re having problems. For me to load up javascript files that were not node modules, I set this property on the BrowserWindow constructor options:

'node-integration': false,

Not sure if this will help or not.

Karl