File tree Expand file tree Collapse file tree 4 files changed +68
-2
lines changed
Expand file tree Collapse file tree 4 files changed +68
-2
lines changed Original file line number Diff line number Diff line change 4646 "@angular-devkit/schematics" : " ~0.0.51" ,
4747 "@schematics/angular" : " ~0.1.16" ,
4848 "autoprefixer" : " ^7.2.3" ,
49+ "cache-loader" : " ^1.2.0" ,
4950 "chalk" : " ~2.2.0" ,
5051 "circular-dependency-plugin" : " ^4.2.1" ,
5152 "clean-css" : " ^4.1.9" ,
114115 "@types/fs-extra" : " ^4.0.0" ,
115116 "@types/glob" : " ^5.0.29" ,
116117 "@types/jasmine" : " 2.5.45" ,
117- "@types/lodash" : " ~4.14.50" ,
118118 "@types/loader-utils" : " ^1.1.0" ,
119+ "@types/lodash" : " ~4.14.50" ,
119120 "@types/minimist" : " ^1.2.0" ,
120121 "@types/mock-fs" : " ^3.6.30" ,
121122 "@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';
1111const ProgressPlugin = require ( 'webpack/lib/ProgressPlugin' ) ;
1212const CircularDependencyPlugin = require ( 'circular-dependency-plugin' ) ;
1313const SilentError = require ( 'silent-error' ) ;
14+ const resolve = require ( 'resolve' ) ;
1415
1516/**
1617 * Enumerate loaders and their dependencies from this file to let the dependency validator
@@ -20,6 +21,7 @@ const SilentError = require('silent-error');
2021 * require('raw-loader')
2122 * require('url-loader')
2223 * require('file-loader')
24+ * require('cache-loader')
2325 * require('@angular-devkit/build-optimizer')
2426 */
2527
@@ -163,12 +165,20 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
163165 }
164166
165167 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+
166173 extraRules . push ( {
167174 test : / \. j s $ / ,
168175 use : [ {
176+ loader : 'cache-loader' ,
177+ options : { cacheDirectory }
178+ } , {
169179 loader : '@angular-devkit/build-optimizer/webpack-loader' ,
170180 options : { sourceMap : buildOptions . sourcemaps }
171- } ]
181+ } ] ,
172182 } ) ;
173183 }
174184
Original file line number Diff line number Diff line change 3434 "@ngtools/webpack" : " 1.10.0-beta.1" ,
3535 "@schematics/angular" : " ~0.1.16" ,
3636 "autoprefixer" : " ^7.2.3" ,
37+ "cache-loader" : " ^1.2.0" ,
3738 "chalk" : " ~2.2.0" ,
3839 "circular-dependency-plugin" : " ^4.2.1" ,
3940 "clean-css" : " ^4.1.9" ,
You can’t perform that action at this time.
0 commit comments