Search code examples
meteortypescriptangular

Cannot compile namespaces when the '--isolatedModules' flag is provided


I am using urigo:angular2-meteor. When I add an empty main.ts in server folder, it always shows:

Cannot compile namespaces when the '--isolatedModules' flag is provided.

Even I added the code below on the top of main.ts, it still shows same thing.

/// <reference path="../typings/angular2-meteor.d.ts" />

Solution

  • I faced similar issue in react + ts. I had commented out all my code.

    Turns out A global file cannot be compiled using '--isolatedModules'. Ensure your file contains imports, exports, or an 'export {}' statement.

    So, added something like:

    export const foo = 'foo';
    

    or

    export {}
    

    It's a temporary solution, else you can delete the file with commented code or update tsconfig.json