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

Re-rexporting a module compiled to export.default = ... #2117

Closed
alexlafroscia opened this issue Jul 29, 2015 · 12 comments
Closed

Re-rexporting a module compiled to export.default = ... #2117

alexlafroscia opened this issue Jul 29, 2015 · 12 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@alexlafroscia
Copy link

I've been doing some IE debugging and noticed a show-stopper that seems to fall into Babel's territory. I keep getting the following issue:

Expected Identifier

Which traces back to the following code:

define('qualaris-mantra/components/ember-wormhole', ['exports', 'ember-wormhole/components/ember-wormhole'], function (exports, ember_wormhole) {

    'use strict';

    exports.default = ember_wormhole.default; // Error points to this line

});

I went and looked up the ember-wormhole code that corresponds to this module, and it can be found here. In case you don't feel like following the link, it's just re-exporting another module.

Is this an issue on Babel's end? To me, it seems like the problem is that Babel translates the re-export to

exports.default = ember_wormhole.default;

instead of

exports['default'] = ember_wormhole['default'];

I looked around at all the other modules and they all seem to use the exports['default'] syntax. It's only an issue with IE, and all the other modules seem to be OK.

@jmm
Copy link
Member

jmm commented Jul 29, 2015

That code is output from babel? What's the input? What babel version?

@alexlafroscia
Copy link
Author

The first code snippet is the Babel output. The code that I linked to here is the input. The babel version is the latest, I just did a fresh npm install and the ember-cli-babel version is 5.1.3.

@jmm
Copy link
Member

jmm commented Jul 29, 2015

Ok, and how are you running babel?

@alexlafroscia
Copy link
Author

This is an Ember CLI app, so it's being run through the ember-cli-babel package which uses broccoli-babel-transpiler, as far as I know.

@jmm
Copy link
Member

jmm commented Jul 29, 2015

That's a lot of layers. It's going to be hard to do anything about it here without a reproduction with just babel. There may be an issue in one of those wrappers.

@alexlafroscia
Copy link
Author

Alright, no problem. I'll look into making a repo to isolate the issue.

@jmm
Copy link
Member

jmm commented Jul 29, 2015

Awesome, thank you. That should help narrow down where the problem lies.

@loganfsmyth
Copy link
Member

Sounds like something somewhere is blacklisting the es3 namespaced transformers: http://babeljs.io/docs/advanced/transformers/es3/member-expression-literals/ but +1 for a reproducible case.

@alexlafroscia
Copy link
Author

Alright, so I tried to reproduce with just Babel and was unable to, it all seems to work correctly. This prompted me to read more about ember-cli-babel and it turns out that it uses a custom module transformation, so I think it makes more sense to open this issue over there instead. If you guys agree, I'll close this here and open it on that repo.

@jmm
Copy link
Member

jmm commented Jul 29, 2015

Yeah, without a reproduction with just babel it's not actionable here. If you think the custom module formatter in the other project is the culprit, raising it over there sounds like the way to go.

@alexlafroscia
Copy link
Author

Alright, well thanks for the help!

@stefanpenner
Copy link
Member

this is an issue with esperanto, pending a PR merge: esperantojs/esperanto#176

(which i forgot to do last night)

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 13, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

4 participants