While attempting to get Angular (1.x) working with systemjs I realized that there is not currently the capability (that I know of) to automatically insert $inject
into angular components, which keeps the components working even when the arguments to the functions are mangled by the minifier. Manually creating the $inject
annotations is tedious, error-prone and violates the DRY principal.
There is a mature npm module called ng-annotate
which solves this problem and is used in many similar situations for bundling. As I've been exploring SystemJS, I see that there is a plugin system that includes the ability to translate source code, which is exactly what ng-annotate
does.
From what I can see, though, SystemJS only gives you the ability to map a particular file extension to a single loader and all the examples of the plugins are to support a new file type. What I would like to do is post-process the output of SystemJS's transpilation process rather than add a new file type. It seems like SystemJS should be able to do this since it has a processing pipeline, but I can't quite figure out how to hook into it the right way. Right now I am using Browserify to achieve the same effect, but I have ended up with a rather complex set of build tasks and I would like to simplify it with SystemJS if possible.
Other strategies to be able to use ng-annotate
in the loader pipeline with SystemJS would be appreciated too.
$inject
it violates DRY. Finally, angular is not the primary topic of the question. – Bayonne