electron-log icon indicating copy to clipboard operation
electron-log copied to clipboard

Can't use electron-log in the preload script while global sandbox is turned on

Open Willyfrog opened this issue 4 years ago • 4 comments

when trying to import electron-log with global sandbox enabled I get this error in the preload script which is causing it to fail to load.

Error: module not found: os

removing electrton-log import seems to take care of it, is there a way to prevent electron-log from loading 'os' in for the preload script?

Willyfrog avatar Jul 27 '21 09:07 Willyfrog

Currently, I have no plans to support sandbox mode. But I'll think on the feature in the next major version.

megahertz avatar Jul 27 '21 10:07 megahertz

@megahertz this isn't just an issue with sandbox. It breaks with the less restrictive contextIsolation as well. Even after adding fallback entries in Webpack, it continues to throw fatal errors.

Merely the following line crashes everything if put into preload:

import log from 'electron-log';

Nantris avatar May 17 '22 23:05 Nantris

Given that the recommended practice from Electron is to sandbox, and that contextIsolation is on by default, I would hope this is a feature that could be added!

eliw00d avatar Aug 31 '22 14:08 eliw00d

@eliw00d I'm already thinking on that.

megahertz avatar Aug 31 '22 15:08 megahertz

Done in v5

megahertz avatar Nov 24 '22 12:11 megahertz