Typescript Modules: Uncaught SyntaxError: Unexpected token import when importing module

Viewed 1662

Setup:

  • VisualStudio 2017
  • asp.net MVC app
  • Typescript: ECMAScript 6, Module System: ES 2015 (don't mind changing those two, if my existing code will still work)

Problem:

I've created many modules in my project. There are also nested modules and everything seems to work. But when starting my app, the console shows: Uncaught SyntaxError: Unexpected token import

So it doesn't know the import statement in my index.ts file (which is not a module!)

index.ts:

import { MyModule} from "./Modules/MyModule";

$().ready(function ()
{
   // some code
});

I've tried many things (changing Module System, ECMAScript version, etc.) and i cannot get it work. Without the import statement my code works, but I want to use TS modules. Any solutions?

0 Answers
Related