renderer preload
See original GitHub issueDescribe the bug Preload not working, in both build and development mode.
Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):
- OS and version: Ubuntu 18.04
- node version: 10.16.2
- vue-cli-plugin-electron-builder version : current
- electron version: 6.0.0
- other vue plugins used: typescript, vuetify, i18n
- custom config for vcp-electron-builder:
electronBuilder: {
mainProcessFile: 'src/electron/background.ts',
chainWebpackMainProcess: (config) => {
config.resolve.alias.set('@', path.join(__dirname, 'src'));
config.resolve.alias.set('@core', path.join(__dirname, 'core'));
config.module.rule('wasm').test(/\.wasm$/).use('file-loader').loader('file-loader');
config.module.rule('node').test(/\.node$/).use('node-loader').loader('node-loader');
},
mainProcessTypeChecking: true,
builderOptions: {},
},
- (if possible) link to your repo: imposible
linked issue: https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/89
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:17 (8 by maintainers)
Top Results From Across the Web
Using Preload Scripts - Electron
In this part of the tutorial, you will learn what a preload script is and how to use one to securely expose privileged...
Read more >How to use preload.js properly in Electron - Stack Overflow
The proper way to use the preload.js in Electron is to expose whitelisted ... Node.js is available in the Main, Preload, and Renderer....
Read more >Electron process model explained (IPC, main, renderer and ...
Preload script contains code that will be executed in the renderer context, before its web content starts loading. This script is actually ran ......
Read more >Electron Preload Script - Quasar Framework
However, you can run Node.js code and bridge it to the renderer thread through an Electron Preload script located at /src-electron/electron-preload.
Read more >fix(plugin-webpack): use proper preload define for renderer by ...
Summarize your changes: Changes the preload define created for production renderer scripts so there is no longer a /renderer/renderer in the path.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

update your
vue.config.jsas so:module.exports = { pluginOptions: { electronBuilder: { preload: ‘src/preload.js’, // Or, for multiple preload files: preload: { preload: ‘src/preload.js’, otherPreload: ‘src/preload2.js’ } } } }
Had the same issue. For me this was fixed by enabling the enableRemoteModule: true flag in the background.ts file, i.e.,
mainWindow = new BrowserWindow({ width: 800, height: 600, frame: false, webPreferences: { preload: path.join(__dirname, 'preload.js'), enableRemoteModule: true, nodeIntegration: true, } })@nklayman Maybe this should be added to the documentation here.