grunt-ts icon indicating copy to clipboard operation
grunt-ts copied to clipboard

amdloader path should be relative to reference file and not outDir

Open jeffmay opened this issue 12 years ago • 1 comments

If you have a project like so:

public/
  app/
    main.ts
    reference.ts
  test/
    reference.ts

then when you attempt to compile them both into the same directory with an AMD loader...

target/
  js/
    app/
      main.ts
      reference.js
      amdloader.js
    test/
      reference.js

the outDir is "target/js" so the paths in amdloader are all set to "./../main.js" instead of "./main.js".

We should think about how we want to handle multiple reference files in a project. Maybe a separate ticket for this?

In this case, it would be simple enough to allow the user to specify the root path of the AMD loader (configuration is always a good option since people -- like myself -- always have exotic needs).

Alongside this though, I think we could more wisely default to using the path to reference file's directory appended with references (and then normalize the paths?)

@basarat what do you think?

jeffmay avatar Dec 26 '13 06:12 jeffmay

amdloader path should be relative to reference file and not outDir

Agreed.

it would be simple enough to allow the user to specify the root path of the AMD loader

If you want to. I have name suggestion though, call it baseUrl since that is what requirejs uses.

basarat avatar Dec 26 '13 21:12 basarat