google / traceur-compiler

Traceur is a JavaScript.next-to-JavaScript-of-today compiler
Apache License 2.0
8.18k stars 580 forks source link

Imports evaluated to object with 'default' property #1982

Open sonicoder86 opened 9 years ago

sonicoder86 commented 9 years ago

I tried use 0.91 version of traceur with es6ify and the only strange thing i get is that the following code: import {ComponentAnnotation, ViewAnnotation, bootstrap} from 'angular'; to

var $__angular__;
var $__0 = ($__angular__ = (typeof window !== "undefined" ? window['ng'] : typeof global !== "undefined" ? global['ng'] : null), $__angular__ && $__angular__.__esModule && $__angular__ || {default: $__angular__}),
    ComponentAnnotation = $__0.ComponentAnnotation,
    ViewAnnotation = $__0.ViewAnnotation,
    bootstrap = $__0.bootstrap; 

And the problem is that the variable $__0 becomes an object with one property which is Angular itself, but because of this every imported property becomes undefined.

What would be the solution?

arv commented 9 years ago

@guybedford @johnjbarton Any ideas?

johnjbarton commented 9 years ago

@blacksonic can you give us some more details? What command do you use to compile? The syntax for your import implies that you must be using a System.map, since otherwise it would end with from 'angular.js'. If you compile the import line with the file loaded explicitly does it work?