electron-userland / electron-compile

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

.babelrc env options are not merged #232

Open wasd171 opened 7 years ago

wasd171 commented 7 years ago

Hello!

I have a following .babelrc file:

{
    "presets": [
        ["env", {
            "targets": {
                "electron": 1.6
            }
        }],
        "react",
        "flow"
    ],
    "plugins": [
        ["module-resolver", {
            "root": ["./src"],
            "cwd": "packagejson"
        }],
        "transform-decorators-legacy",
        "transform-class-properties",
        "transform-object-rest-spread"
    ],
    "env": {
        "development": {
            "sourceMaps": "inline"
        },
        "production": {
            "sourceMaps": "none"
        }
    }
}

Following babel docs I expected env options to be merged with non-env options. However it seems that electron-compile is only selecting env options, dropping others. I get messages like SyntaxError: Unexpected token import. Running babel from command line works, so it might be a bug

anaisbetts commented 7 years ago

We reimplemented this support by hand, back then it didn't do that. I'd take a PR to correct this behavior though since it doesn't look like a breaking change

crdrost commented 6 years ago

Note that Babel env is in the process of being deprecated in favor of in-JS configuration (babel#5276)