@@ -67,19 +67,6 @@ const init = (config) => {
67
67
. map ( ( file ) => config . preprocessors [ file ] )
68
68
. map ( ( arr ) => arr . splice ( arr . indexOf ( '@angular/cli' ) , 1 , 'webpack' , 'sourcemap' ) ) ;
69
69
70
- // Add polyfills file
71
- if ( appConfig . polyfills ) {
72
- const polyfillsFile = path . resolve ( appRoot , appConfig . polyfills ) ;
73
- const polyfillsPattern = {
74
- pattern : polyfillsFile ,
75
- included : true ,
76
- served : true ,
77
- watched : true
78
- }
79
- Array . prototype . unshift . apply ( config . files , [ polyfillsPattern ] ) ;
80
- config . preprocessors [ polyfillsFile ] = [ 'webpack' , 'sourcemap' ] ;
81
- }
82
-
83
70
// Add global scripts
84
71
if ( appConfig . scripts && appConfig . scripts . length > 0 ) {
85
72
const globalScriptPatterns = appConfig . scripts
@@ -98,6 +85,19 @@ const init = (config) => {
98
85
// karma already has a reference to the existing array.
99
86
Array . prototype . unshift . apply ( config . files , globalScriptPatterns ) ;
100
87
}
88
+
89
+ // Add polyfills file before everything else
90
+ if ( appConfig . polyfills ) {
91
+ const polyfillsFile = path . resolve ( appRoot , appConfig . polyfills ) ;
92
+ const polyfillsPattern = {
93
+ pattern : polyfillsFile ,
94
+ included : true ,
95
+ served : true ,
96
+ watched : true
97
+ }
98
+ Array . prototype . unshift . apply ( config . files , [ polyfillsPattern ] ) ;
99
+ config . preprocessors [ polyfillsFile ] = [ 'webpack' , 'sourcemap' ] ;
100
+ }
101
101
}
102
102
103
103
init . $inject = [ 'config' ] ;
0 commit comments