require() typescript files.


RequireTS is an nodejs module which allows you to require() typescript files.

It provides different approach then other typescript require modules because it compiles all modified scripts before it registers the .ts extension loader.

RequireTS is written in TypeScript :)

RequireTS is written in TypeScript so you can modify it very easily. If you want to build the library, there is a build script provided.

npm install require-ts
  sourcePath: 'path/to/typescript/files/directory',
  buildPath: 'destination/folder/for/compiled/files',
  excludeDeclarationFiles: true //default is true 
//then you can: 

Compiler will compile all modified files in sourcePath directory and place their compiled versions inside the buildPath directory. Directory structury should be preserved.

When the excludeDeclarationFiles flag is set to false then compiler will try to compile also files with .d.ts extension which usually is not what we want.

__dirname will point to typescript file location

RequireTS is distributed under ISC license (which is even simpler MIT style license) so you can use it even in your commercial projects. Just don't delete the LICENSE file.