electron-userland / electron-compile

DEPRECATED: Electron supporting package to compile JS and CSS in Electron applications
1.01k stars 99 forks source link

babel-preset-env gives warning about decimal version numbers #258

Closed frxstrem closed 6 years ago

frxstrem commented 7 years ago

When running Electron using electron-prebuilt-compile, I get the following warning:

Warning, the following targets are using a decimal version:

  electron: 1.7

We recommend using a string for minor/patch versions to avoid numbers like 6.10
getting parsed as 6.1, which can lead to unexpected behavior.

This warning seems to be caused by babel-preset-env in line 408 of config-parser.js:

export function getDefaultConfiguration(rootDir) {
  return {
    'application/javascript': {
      "presets": [
        ["env", {
          "targets": {
            "electron": getElectronVersion(rootDir) // <--- line 408
          }
        }],
        "react"
      ],
      "sourceMaps": "inline"
    }
  };
}

getElectronVersion seems to return a decimal version when babel-preset-env wants a string version.

The problematic code seems to have been introduced in #214.

This issue has also already been posted in another repository: electron-userland/electron-prebuilt-compile#45

ddavidebor commented 7 years ago

annoying

malept commented 7 years ago

Feel free to file a pull request to fix it and it will get reviewed.