nklayman / vue-cli-plugin-electron-builder

Easily Build Your Vue.js App For Desktop With Electron

Home Page:https://nklayman.github.io/vue-cli-plugin-electron-builder/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WebpackOptionsValidationError configuration.target electron-preload

leongrdic opened this issue · comments

commented

I'm getting the following error from webpack when i try to add preload: 'src/preload.js' to my vue.config.js:

WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.target should be one of these:
   "web" | "webworker" | "node" | "async-node" | "node-webkit" | "electron-main" | "electron-renderer" | function
...

I'm using Webpack 4.28.4 which apparently doesn't support the electron-preload target that's currently hardcoded in this plugin:

preloadConfig.target('electron-preload')

When I manually change the line above to 'electron-renderer', everything works as expected.

What are my options, how can I avoid this error and preload the file?

The plugin is using webpack 4.46 right now. So try to update. Though I think it has worked with older webpack 4.x too.

commented

How would you suggest I do that? I don't have webpack anywhere in my package.json.

I found that electron-preload has been introduced in Webpack v4.33.0 (https://github.com/webpack/webpack/releases/tag/v4.33.0)

Shouldn't this plugin's minimum webpack version be at least 4.33.0 then? (sorry if I got something wrong)

"webpack": "^4.18.0",