I am using Vue CLI 3 and vue-cli-plugin-electron-builder to package my Vue Electron app and I am not able to get my preload.js script for electron working.
vue-cli-plugin-electron-builder
The solution was more simple than expected. Imports work in window.onload event.
window.onload
window.onload = () => { const { dialog } = require("electron").remote; window.electron = {}; window.electron.dialog = dialog; // now set properly };