require.js runtime error when importing angular 2

747 views Asked by At

I'm trying to run a typescript project (I'm using vs2012) and to import angular 2. the projects is set to AMD module system and ECMAcript 5

In ts filed I'm importing the module: import ng2 = require('angular2/angular2');

=> in js file it replaced to: define(["require", "exports"], function (require, exports) {

And I'm getting this require.js runtime error:

 Mismatched anonymous define() module: function (require, exports) {
   ....
   // code 
   ....
}

Is anyone knows what the cause of it?

Thanks a lot! Lior

1

There are 1 answers

0
shmck On

Try using the new ES6 syntax for importing files.

Example: import {bootstrap} from 'angular2/angular2';

This Angular2 Visual Studio tutorial can help you setup your project.