Permalink
Browse files

fix(build): prevent closure from stripping $inject annotations (#9765)

Adds a config that will turn instances of `something.$inject` into `something['$inject']`.
This helps in cases where Closure strips the injector due to the object annotation having a `@constructor` directive.
Note that the regular JS builds have the same output as before.

Fixes #9758.
  • Loading branch information...
1 parent af041da commit dbc52d020ec6c58f178efee3ce5271c454c27409 @crisbeto crisbeto committed with jelbourn Oct 27, 2016
Showing with 7 additions and 0 deletions.
  1. +7 −0 gulp/util.js
View
@@ -149,6 +149,13 @@ function buildModule(module, opts) {
{
pattern: /\@ngInject/g,
replacement: 'ngInject'
+ },
+ {
+ // Turns `thing.$inject` into `thing['$inject']` in order to prevent
+ // Closure from stripping it from objects with an @constructor
+ // annotation.
+ pattern: /\.\$inject\b/g,
+ replacement: "['$inject']"
}
];
return lazypipe()

0 comments on commit dbc52d0

Please sign in to comment.