diff --git a/packages/plugin/webpack/src/WebpackConfig.ts b/packages/plugin/webpack/src/WebpackConfig.ts index f22c6b88ae..6af6672e33 100644 --- a/packages/plugin/webpack/src/WebpackConfig.ts +++ b/packages/plugin/webpack/src/WebpackConfig.ts @@ -114,7 +114,8 @@ export default class WebpackConfigGenerator { if (this.isProd) { return `\`file://$\{require('path').resolve(__dirname, '..', 'renderer', '${entryPoint.name}', '${basename}')}\``; } - const baseUrl = `http://localhost:${this.port}/${entryPoint.name}`; + const protocol = this.pluginConfig.devServer?.server === 'https' ? 'https' : 'http'; + const baseUrl = `${protocol}://localhost:${this.port}/${entryPoint.name}`; if (basename !== 'index.html') { return `'${baseUrl}/${basename}'`; }