Pros & Cons of using requirejs (-m amd) for typescript+angular projects

879 views Asked by At

For an angular 1.x project that uses typescript, what are the Pros and Cons of using AMD? Meaning, running tsc with the params -m amd and using requirejs, versus simply using the /// <reference path="..." /> for internal modules as well and wrapping in module(s).

Which-

  1. Makes more sense for angularjs? (if you think one is better than the other in this particular case).
  2. Is better for large scale angular apps?
  3. Would be better at minification+obfuscation of large code base?
1

There are 1 answers

7
basarat On BEST ANSWER
  1. Makes more sense for angularjs?

Angular1 : --module amd Angular2 : --module system as that is what the angularjs team uses internally.

  1. Is better for large scale angular apps?

Yes. --out and reference comments are a bad idea. More : https://github.com/TypeStrong/atom-typescript/blob/master/docs/out.md

  1. Would be better at minification+obfuscation of large code base?

It would be the same. The main advantage is dev time readability and maintainability.