Tag Archives: electron-vue

[Solved] electron-vue project error: Object.fromEntries is not a function electron-vue

electron-vue scaffold project build error: Object.fromEntries is not a function

Project directory

Front console print error:

Solution: install polyfill-object.fromentries and execute the command in the project root directory

npm i polyfill-object.fromentries

And then

import

import 'polyfill-object.fromentries';

An error is reported when the electron Vue Vue component introduces the electron

Question:

Remote module of electron introduced into Vue component:

let { remote } = require("electron");

An error is reported when the electron application starts.

solve:

1. Add window before require, that is:

let { remote } = window.require("electron");

2. Add vue.config.js file in the root directory of the project, and the configuration is as follows:

module.exports = {
    pluginOptions: {
        electronBuilder: {
            nodeIntegration: true
        }
    }
}

The above two methods can be solved.

Of course, the webpreferences property of browserwindow should also be configured correctly:

webPreferences: {
      nodeIntegration: true,
      contextIsolation: false,
      enableRemoteModule: true
    }