Skip to content

Commit 16d5ea1

Browse files
committed
fix(lib/webpackConfig): request error, fixes #546
Disable prefetch on electron versions greater than 7 due to electron/electron#21091 The error is the same, but the cause request type is different
1 parent f5c19c0 commit 16d5ea1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/webpackConfig.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ async function chainWebpack (api, pluginOptions, config) {
4141
args[0].__static = JSON.stringify(api.resolve('./public'))
4242
return args
4343
})
44+
const pkg = require(api.resolve('package.json'))
45+
const semver = require('semver')
46+
const electronVersion = pkg.devDependencies.electron
47+
// Prefetch requests fail on Electron versions greater than 7
48+
// https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/546
49+
if (
50+
/^\^?(\d|\.)*$/.test(electronVersion) &&
51+
semver.gte(electronVersion.replace('^', ''), '7.0.0')
52+
) {
53+
config.plugins.delete('prefetch')
54+
}
4455
}
4556
// Apply user config
4657
rendererProcessChain(config)

0 commit comments

Comments
 (0)