Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default property with OR #18

Open
ediblecode opened this issue Feb 27, 2019 · 0 comments
Open

Default property with OR #18

ediblecode opened this issue Feb 27, 2019 · 0 comments

Comments

@ediblecode
Copy link

I'm supporting IE8 (I know, I know) in a project, and using react hot loader in dev, then looking at swapping out Nerv or Preact in production to support older browsers. (Yup all sounds crazy). But anyway, the following line is causing an error:

Module parse failed: Unexpected token. You may need an appropriate loader to handle this file type.

at:

var reactHotLoader = (typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal : require('react-hot-loader')["default"];

I've create a simpler repro scenario to demonstrate the actual issue:

Repro steps

Run the following:

var transform = require('es3ify').transform;
console.log(transform(`(a || b).default`));

Expected result

(a || b)["default"]

Actual result

(a || b["default"]
// Note: missing closing bracket

Anyway, I think I can get round this using the babel-plugin-transform-es3-member-expression-literals plugin instead (similar to reduxjs/redux#1688) but raising it here in case anyone else encounters the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant