File tree 4 files changed +68
-2
lines changed
4 files changed +68
-2
lines changed Original file line number Diff line number Diff line change 46
46
"@angular-devkit/schematics" : " ~0.0.51" ,
47
47
"@schematics/angular" : " ~0.1.16" ,
48
48
"autoprefixer" : " ^7.2.3" ,
49
+ "cache-loader" : " ^1.2.0" ,
49
50
"chalk" : " ~2.2.0" ,
50
51
"circular-dependency-plugin" : " ^4.2.1" ,
51
52
"clean-css" : " ^4.1.9" ,
114
115
"@types/fs-extra" : " ^4.0.0" ,
115
116
"@types/glob" : " ^5.0.29" ,
116
117
"@types/jasmine" : " 2.5.45" ,
117
- "@types/lodash" : " ~4.14.50" ,
118
118
"@types/loader-utils" : " ^1.1.0" ,
119
+ "@types/lodash" : " ~4.14.50" ,
119
120
"@types/minimist" : " ^1.2.0" ,
120
121
"@types/mock-fs" : " ^3.6.30" ,
121
122
"@types/node" : " ^6.0.84" ,
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { ScriptsWebpackPlugin } from '../../plugins/scripts-webpack-plugin';
11
11
const ProgressPlugin = require ( 'webpack/lib/ProgressPlugin' ) ;
12
12
const CircularDependencyPlugin = require ( 'circular-dependency-plugin' ) ;
13
13
const SilentError = require ( 'silent-error' ) ;
14
+ const resolve = require ( 'resolve' ) ;
14
15
15
16
/**
16
17
* Enumerate loaders and their dependencies from this file to let the dependency validator
@@ -20,6 +21,7 @@ const SilentError = require('silent-error');
20
21
* require('raw-loader')
21
22
* require('url-loader')
22
23
* require('file-loader')
24
+ * require('cache-loader')
23
25
* require('@angular-devkit/build-optimizer')
24
26
*/
25
27
@@ -163,12 +165,20 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
163
165
}
164
166
165
167
if ( buildOptions . buildOptimizer ) {
168
+ // Set the cache directory to the Build Optimizer dir, so that package updates will delete it.
169
+ const buildOptimizerDir = path . dirname (
170
+ resolve . sync ( '@angular-devkit/build-optimizer' , { basedir : projectRoot } ) ) ;
171
+ const cacheDirectory = path . resolve ( buildOptimizerDir , './.cache/' ) ;
172
+
166
173
extraRules . push ( {
167
174
test : / \. j s $ / ,
168
175
use : [ {
176
+ loader : 'cache-loader' ,
177
+ options : { cacheDirectory }
178
+ } , {
169
179
loader : '@angular-devkit/build-optimizer/webpack-loader' ,
170
180
options : { sourceMap : buildOptions . sourcemaps }
171
- } ]
181
+ } ] ,
172
182
} ) ;
173
183
}
174
184
Original file line number Diff line number Diff line change 34
34
"@ngtools/webpack" : " 1.10.0-beta.1" ,
35
35
"@schematics/angular" : " ~0.1.16" ,
36
36
"autoprefixer" : " ^7.2.3" ,
37
+ "cache-loader" : " ^1.2.0" ,
37
38
"chalk" : " ~2.2.0" ,
38
39
"circular-dependency-plugin" : " ^4.2.1" ,
39
40
"clean-css" : " ^4.1.9" ,
You can’t perform that action at this time.
0 commit comments