2

how come Game is not a function when imported via System

import Core from 'gameUnits/Core' 

export class Game { 
constructor() {

core:

export class Core {
    constructor(scene) {
    }
}

etc

and in the browser:

     <script src="bower_components/traceur/traceur.js"></script>
  <script src="bower_components/es6-module-loader/dist/es6-module-loader.js"></script>
  <script>
    System.import('Game').then(function (Game) {
      game = new Game();
    });
  </script>
SuperUberDuper
  • 9,242
  • 9
  • 39
  • 72
  • 3
    `export default class Game {...}` might be more useful. Instead of a `Module` type object with a `Game` property, it exports `Game` directly. – Sean McMillan Jan 21 '15 at 18:56

1 Answers1

3

The module object in your case isn't Game, it contains Game. Try:

System.import('Game').then(function ({Game}) {
  game = new Game();
});
Andreas Rossberg
  • 34,518
  • 3
  • 61
  • 72