Reputation:
I am working with angular, typescript and gulp, my module system is common js and i try to import a module to my main.ts file and its throw the error:
Cannot find external module 'modules.ts'.
main.ts:
/// <reference path="../../typings/tsd.d.ts" />
import modules from 'modules.ts';
const app = angular.module('myApp', []);
modules.ts:
module test {
export class a {
}
}
Upvotes: 0
Views: 313
Reputation: 7246
Your problem seems to be that modules.ts
does not export anything, and therefore will not compile to a valid commonjs module.
Try this:
// modules.ts
export module test {
export class a {
}
}
Then in some other file:
import {test} from 'modules';
var foo = new test.a();
This should work, read more about the ES6 Modules to learn the ins and outs of the new import/export syntax.
Upvotes: 2