Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit dbc52d0

Browse files
crisbetojelbourn
authored andcommitted
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.
1 parent af041da commit dbc52d0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

gulp/util.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ function buildModule(module, opts) {
149149
{
150150
pattern: /\@ngInject/g,
151151
replacement: 'ngInject'
152+
},
153+
{
154+
// Turns `thing.$inject` into `thing['$inject']` in order to prevent
155+
// Closure from stripping it from objects with an @constructor
156+
// annotation.
157+
pattern: /\.\$inject\b/g,
158+
replacement: "['$inject']"
152159
}
153160
];
154161
return lazypipe()

0 commit comments

Comments
 (0)