google / traceur-compiler

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

The compile result with es6 module is not equal to TypeScript and Babel. #2139

Open hstarorg opened 7 years ago

hstarorg commented 7 years ago

Like these codes:

// lib.js
export let c = {
  name: 'Hello'
};

export function ins() {
  return c.name
};

export function reset() {
  c = {
    name: 'Hello'
  };
};
import { c, ins, reset } from './lib';

c.name = '222';

console.log(c);
console.log(ins());

reset();
console.log(ins());
console.log(c);

When execute index.js that use babel or TypeScript compiled will print

{ name: '222' }
222
Hello
{ name: 'Hello' }

But use traceur, that will print

{ name: '222' }
222
Hello
{ name: '222' }

Would you tell us, which compiler is compile right?

arv commented 7 years ago

The expected output is what Babel outputs. Traceur should output the same thing. We have tests for that. What options are you compiling with?

hstarorg commented 7 years ago

Use the defaults compiling options.