Electron +vue error solution:

1. Error code:
ERROR in Template execution failed: ReferenceError: process is not defined

ERROR in   ReferenceError: process is not defined

- index.ejs:11 eval[.]/[html-webpack-plugin]/lib/loader.js! ./src/index.ejs:11:2

- index.ejs:16 module.exports [.]/[html-webpack-plugin]/lib/loader.js! ./src/index.ejs:16:3

- index.js:284 
[electron-test]/[html-webpack-plugin]/index.js:284:18

- runMicrotasks

- task_queues.js:93 processTicksAndRejections
internal/process/task_queues.js:93:5

Copy the code
The solution

Modified. Electron – vue/webpack. Web. Config. Js and. Electron – vue/webpack. The renderer. Config. HtmlWebpackPlugin js file, add templateParameters, Modified as follows:

new HtmlWebpackPlugin({
	filename: 'index.html'.template: path.resolve(__dirname, '.. /src/index.ejs'),
	templateParameters(compilation, assets, options) {
		return {
			compilation: compilation,
			webpack: compilation.getStats().toJson(),
			webpackConfig: compilation.options,
			htmlWebpackPlugin: {
				files: assets,
				options: options
			},
			process,
		};
	},
	minify: {
		collapseWhitespace: true.removeAttributeQuotes: true.removeComments: true
	},
	nodeModules: false
}),

Copy the code
2. When creating a project using the electron forge init notepage command, the dependency package is loaded and cannot run

Replace the configuration file package.json with

{
  "name": "my-new-app"."productName": "my-new-app"."version": "1.0.0"."description": "My Electron application description"."main": "src/index.js"."scripts": {
    "start": "electron-forge start"."package": "electron-forge package"."make": "electron-forge make"."publish": "electron-forge publish"."lint": "eslint src --color"
  },
  "keywords": []."author": "Administrator"."license": "MIT"."config": {
    "forge": {
      "make_targets": {
        "win32": [
          "squirrel"]."darwin": [
          "zip"]."linux": [
          "deb"."rpm"]},"electronPackagerConfig": {
        "packageManager": "yarn"
      },
      "electronWinstallerConfig": {
        "name": "my_new_app"
      },
      "electronInstallerDebian": {},
      "electronInstallerRedhat": {},
      "github_repository": {
        "owner": ""."name": ""
      },
      "windowsStoreConfig": {
        "packageName": ""."name": "mynewapp"}}},"dependencies": {
    "electron-compile": "^ 6.4.4." "."electron-squirrel-startup": "^ 1.0.0"
  },
   "devDependencies": {
      "babel-plugin-transform-async-to-generator": "^ 6.24.1"."babel-preset-env": "^ 1.7.0"."babel-preset-react": "^ 6.24.1"."electron-forge": "^ 5.2.2." "."electron-prebuilt-compile": "2.0.4"."eslint": "^ 3"."eslint-config-airbnb": "^ 15"."eslint-plugin-import": "^ 2"."eslint-plugin-jsx-a11y": "^ 5"."eslint-plugin-react": "^ 7"}}Copy the code

Then run NPM install again to reload the dependencies and the project runs ok

3. The Element component cannot be installed in the electron-vue
Open the file: electron - vue/webpack. The renderer. Config. Js around about 21 lines to find the let whiteListedModules element - the user interface (UI) added, eventually as shown below. Let whiteListedModules = ['vue', 'element-ui'] and then restart the project.Copy the code