Search code examples
visual-studiovisual-studio-2013requirejstypescriptamd

How does Visual Studio determine typescript base path when not explicitly configured


Using Visual Studio 2013 Update 3. I use external modules to reference the different modules (AMD+require.js)

I have a asp.net web project that have a structure look something like this:

App/first/firstmodule.ts
App/second/secondmodule.ts

firstmodule.ts looks like this:

import first = require("first/firstmodule");
.. do stuff..

Notice that secondmodule reference firstmodule relative to a base path. (App/). Visual Studio gives no warnings/errors on this, and everything is fine.

I haven't configured this path 'App/' base path anywhere (as far as I know).

The csproj project settings 'TypeScriptSourceRoot' and 'TypeScriptMapRoot' are not configured.

Where does this 'App/' base path value come from, that Visual Studio obviously knows about?


Solution

  • I haven't configured this path 'App/' base path anywhere (as far as I know).

    That is correct.

    What it does is : It looks at every parent folder and appends to see the path. As such this has the potential to be an incorrect assumption and your code will fail at runtime if you don't have a good base path configured.