Search code examples
javascriptpathrequirejstypescriptamd

Using absolute module paths in Typescript (requirejs paths config)


Is it possible to use module paths without having to use /// reference path.. with a .d.ts file?

For example if I have this in my requirejs config file :

require.config(
    {
       paths: {
          test : "/test/test1/TestFile"
       }
    }
);

I want to use : import TestFile = require('test')

instead of having to use : import TestFile = require('/test/test1/TestFile')


Solution

  • I want to use : import TestFile = require('test') instead of having to use : import TestFile = require('/test/test1/TestFile')

    Not at the moment. You need to have a complete relative path OR use a module declaration.

    FYI : grunt-ts can generate these long relative paths for you https://github.com/grunt-ts/grunt-ts/issues/85