electron-compile icon indicating copy to clipboard operation
electron-compile copied to clipboard

JS file with a unique export (not default) is invalid

Open magne4000 opened this issue 7 years ago • 2 comments

I have the following selectors.js file

export const isUpdateAvailable = state => state.getIn(['auto_update', 'updateAvailable']);

When I try to import it import { isUpdateAvailable } from 'selectors', electron (in a renderer) complains that it does not know export keyword.

If I try to add a second export in that file, not more error (with the same import)

export const isUpdateAvailable = state => state.getIn(['auto_update', 'updateAvailable']);

export const dummy = null;

Any ideas ?

my .compilerc

{
  "text/scss": {},
  "application/javascript": {
    "presets": [
      "react",
      "es2017-node7"
    ],
    "plugins": [
      "add-module-exports",
      "transform-async-to-generator",
      "transform-decorators-legacy"
    ],
    "env": {
      "production": {
        "plugins": [
          "babel-plugin-dev-expression"
        ]
      },
      "development": {
        "plugins": [
		  "react-hot-loader/babel"
		]
      }
    }
  }
}

magne4000 avatar Jun 13 '17 09:06 magne4000

I'm having the same issue, did you end up fixing this?

liamaharon avatar Jun 26 '18 05:06 liamaharon

@liamaharon I think the issue still isn't fixed. For the project which we having the issue, we now have mostly TypeScript files now in our codebase, and those work fine.

magne4000 avatar Jun 26 '18 12:06 magne4000