Skip to content

import/export broken because of IIFE #104

@timdp

Description

@timdp

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.)

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions