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

import/export broken because of IIFE #104

Open
timdp opened this issue Nov 30, 2014 · 0 comments
Open

import/export broken because of IIFE #104

timdp opened this issue Nov 30, 2014 · 0 comments

Comments

@timdp
Copy link

timdp commented Nov 30, 2014

I was examining our options for #50 and came across some annoying behavior. Because the compiler wraps everything in an IIFE, I can't seem to run generated ES6 module code through Traceur. For example, I ended up with code along the lines of:

"use strict";
(function() {
  import A from "A";
  function B() { }
  export default B;
})();

but that won't fly because Traceur expects the import to be outside of the IIFE.

For now, I've added an extra task to my Gruntfile to strip out the IIFE. However, we should either have a way to make the IIFE optional, or, preferably, hoist the imports out of it and return the exports from it.

(Or am I doing something horribly wrong? I'm basically compiling my code to ES6, then creating a System.js build from it, and finally loading it in Chrome. With the IIFE patch, that works well.)

@alongubkin alongubkin added the bug label Nov 30, 2014
@alongubkin alongubkin added this to the 0.1.3 milestone Nov 30, 2014
@alongubkin alongubkin self-assigned this Nov 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants