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

electron-builder redistributables can't find preload.js #17

Open
nukeop opened this issue Jul 28, 2018 · 3 comments
Open

electron-builder redistributables can't find preload.js #17

nukeop opened this issue Jul 28, 2018 · 3 comments

Comments

@nukeop
Copy link

nukeop commented Jul 28, 2018

I noticed that my electron program fails to start because it can't find preload.js. Looking at the webpack-compiled bundle, I found that the culprit must be electron-timber, since it's the only module that looks for preview.js. Here's the output:

[26945:0728/234248.108082:ERROR:CONSOLE(164)] "Unable to load preload script: /home//projects/electron/nuclear/release/linux-unpacked/resources/app.asar/dist/preload.js", source: /home//projects/electron/nuclear/release/linux-unpacked/resources/electron.asar/renderer/init.js (164)
[26945:0728/234248.108149:ERROR:CONSOLE(165)] "Error: Cannot find module '/home//projects/electron/nuclear/release/linux-unpacked/resources/app.asar/dist/preload.js'
    at Module._resolveFilename (module.js:543:15)
    at Function.Module._resolveFilename (/home//projects/electron/nuclear/release/linux-unpacked/resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.Module._load (module.js:473:25)
    at Module.require (module.js:586:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home//projects/electron/nuclear/release/linux-unpacked/resources/electron.asar/renderer/init.js:162:5)
    at Object.<anonymous> (/home//projects/electron/nuclear/release/linux-unpacked/resources/electron.asar/renderer/init.js:188:3)
    at Module._compile (module.js:642:30)
    at Object.Module._extensions..js (module.js:653:10)
    at Module.load (module.js:561:32)", source: /home//projects/electron/nuclear/release/linux-unpacked/resources/electron.asar/renderer/init.js (165)

It loads fine in debug build. What prevents it from running in production build?

@sindresorhus
Copy link
Owner

You have to exclude the preload.js script in this package from being compiled with Webpack.

@sindresorhus
Copy link
Owner

I've opened an Electron feature request to make this just work: electron/electron#14012

@nukeop
Copy link
Author

nukeop commented Aug 11, 2018

Adding exclude: /node_modules\/electron\-timber\/preload\.js/ to the jsx parsing rule in webpack did the trick, thanks for the help.

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