2
votes

The Angular2 demo uses Traceur and System.JS to implement ES6 module syntax. Since Typescript 1.5 now includes this syntax, is the separate ES6 module loader still required? Any ideas of how to do without it?

<head>
  <title>Angular 2 Quickstart</title>
  <script src="https://github.jspm.io/jmcriffey/[email protected]/traceur-runtime.js"></script>
  <script src="https://jspm.io/[email protected]"></script>
  <script src="https://code.angularjs.org/2.0.0-alpha.28/angular2.dev.js"></script>
</head>
<my-app></my-app>
<script>System.import('app');</script>
1

1 Answers

2
votes

Whenever you transpile ES6+ code that uses ES6 modules to ES5, you have to decide for a module system that works in ES5. That can be CommonJS, AMD, SystemJS, UMD.

Even if TypeScript is going to be a superset of ES6 and implement ES6 modules, as soon as you transpile your code, you need to use a module system that the browser understands today.

Unfortunately, there's no spec that defines how modules are loaded anymore. So yes, you'd still need to use something like SystemJS to load modules in ES5.