electron-userland / electron-userland/electron-webpack

Wrong `getVersion` reported when using `electron-webpack`.

Open
#353 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
902
Forks
168
PR merge metrics
No merged PRs in 30d

Description

* **Version**: 2.7.4
* **Target**: MacOS

When using `electron-webpack dev`, and running in main process `console.log(Electron.app.getVersion())` I get `8.0.2` as a result, which is Electron version. According to https://github.com/electron/electron/issues/7085 , the version reported by `getVersion` depends on how the `electron` command was run under the hood:

> In development the version returned by app.getVersion() depends on how you launched your app. If you launched it with electron path/to/app/package_dir the version will match the one in your package.json, however, if you launched your app with electron path/to/main.js then you'll get the Electron version. This is because in the latter case Electron will actually read the package.json of the default app, which doesn't specify a version, so it will default to the Electron version. Once you package your app the version will always be read from your package.json.

I believe the current behavior is very confusing and error prone. Can we always report the correct version when using `electron-webpack` instead?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.