Everlaw / nbts

NetBeans TypeScript editor plugin
282 stars 46 forks source link

Export class with "Cannot compile modules unless the '--module' flag is provided" error #26

Closed danielschmitz closed 8 years ago

danielschmitz commented 8 years ago

File index.ts:

import {Foo} from "Foo"
var test = new Foo();

File Foo.ts

export class Foo{

}

Error: captura de tela de 2015-12-04 17-21-51

project: ModuleError.zip

jeffrey-easyesi commented 8 years ago

You need to create a tsconfig.json file with the compiler options for your project, including the kind of module you are compiling to:

{
    "compilerOptions": {
        "module": "<module kind>"
    }
}

As of 1.7, the supported module kinds are "commonjs", "amd", "system", "umd", and "es6". You'll need to put in the kind of module used by the loader or build system that consumes your .js files.

danielschmitz commented 8 years ago

Thank you!