Closed ekottifiok closed 1 year ago
Did you try this in the main
or renderer
package?
Renderer
Does it work on the main? Would try
If you want to do this in the renderer you have to enable the node integration for the browser window. This is not recommended for security reasons but if you want to try it out, set nodeIntegration: true
when creating the browser window:
packages/main/src/index.ts
const createBrowserWindow = (): BrowserWindow => {
return new BrowserWindow({
autoHideMenuBar: true,
webPreferences: {
nodeIntegration: true,
preload: join(__dirname, "..", "..", "preload", "dist", "index.cjs"),
},
});
};
it's an electron error this is the error screenshot https://drive.google.com/file/d/1IxB-evwY3Fn9RWeq8bFKdJxm5sCxvnlF/view?usp=share_link
Then I guess we can close this?
okay thanks for your speedy reply to the issue
When I
import { desktopCapturer } from "electron";
and use it like this:desktopCapturer.getSources({ types: ['window', 'screen'] })
Uncaught ReferenceError: __dirname is not defined