Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use electron-log/preload in preload script #434

Open
TheOneTheOnlyJJ opened this issue Aug 2, 2024 · 1 comment
Open

Cannot use electron-log/preload in preload script #434

TheOneTheOnlyJJ opened this issue Aug 2, 2024 · 1 comment

Comments

@TheOneTheOnlyJJ
Copy link

TheOneTheOnlyJJ commented Aug 2, 2024

Attempting to import electron-log/preload in my preload file throws the following error:

[2024-08-02 18:20:22.052] [error]                             WebContents#preload-error: {
  preloadPath: 'C:\\Users\\Andrei\\Desktop\\BlackBox\\out\\preload\\preload.js',
  error: 'Error: module not found: electron-log/preload\n' +
    '    at preloadRequire (node:electron/js2c/sandbox_bundle:2:82852)\n' +
    '    at <anonymous>:4:1\n' +
    '    at runPreloadScript (node:electron/js2c/sandbox_bundle:2:83516)\n' +
    '    at node:electron/js2c/sandbox_bundle:2:83813\n' +
    '    at node:electron/js2c/sandbox_bundle:2:83968\n' +
    '    at ___electron_webpack_init__ (node:electron/js2c/sandbox_bundle:2:83972)\n' +
    '    at node:electron/js2c/sandbox_bundle:2:84095',
  webContents: { id: 1, url: 'http://localhost:5173/' }
}

I am using electron-vite 2.3.0 as my build tool and electron 31.2.1.

@megahertz
Copy link
Owner

Preload code should be bundled together with all dependencies (except for a case when nodeIntegration is enabled).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants