require or import statement don't work in "renderer.ts"
serge-hulne opened this issue · 2 comments
serge-hulne commented
require or import statement doesn't work in "renderer.ts"
Is this feature missing?
How do you divide the code into modules if the renderer needs to import stuff from a lib?
Thanks.
erickzhao commented
Hey @serge-hulne, this quick-start has nodeIntegration
disabled, so Node is not exposed to the renderer process. This is a default that's there for security purposes.
To enable Node integration, you can modify the mainWindow
constructor in main.ts
:
// Create the browser window.
const mainWindow = new BrowserWindow({
height: 600,
webPreferences: {
preload: path.join(__dirname, "preload.js"),
nodeIntegration: true,
},
width: 800,
});
serge-hulne commented
Thanks,
But now I'm getting the error:
Uncaught ReferenceError: exports is not defined
at renderer.js:2