99 * found in the LICENSE file at https://angular.io/license
1010 */
1111
12- import { Compiler } from 'webpack' ;
13- import { RawSource , SourceMapSource } from 'webpack-sources' ;
12+ import { Compiler , compilation } from 'webpack' ;
13+ import { RawSource , Source , SourceMapSource } from 'webpack-sources' ;
1414
1515const CleanCSS = require ( 'clean-css' ) ;
1616
@@ -60,7 +60,7 @@ export class CleanCssWebpackPlugin {
6060 }
6161
6262 apply ( compiler : Compiler ) : void {
63- hook ( compiler , ( compilation : any , chunks : Array < Chunk > ) => {
63+ hook ( compiler , ( compilation : compilation . Compilation , chunks : Array < Chunk > ) => {
6464 const cleancss = new CleanCSS ( {
6565 compatibility : 'ie9' ,
6666 level : 2 ,
@@ -80,7 +80,7 @@ export class CleanCssWebpackPlugin {
8080 const actions = files
8181 . filter ( file => this . _options . test ( file ) )
8282 . map ( file => {
83- const asset = compilation . assets [ file ] ;
83+ const asset = compilation . assets [ file ] as Source ;
8484 if ( ! asset ) {
8585 return Promise . resolve ( ) ;
8686 }
@@ -100,7 +100,7 @@ export class CleanCssWebpackPlugin {
100100 }
101101
102102 return Promise . resolve ( )
103- . then ( ( ) => cleancss . minify ( content , map ) )
103+ . then ( ( ) => map ? cleancss . minify ( content , map ) : cleancss . minify ( content ) )
104104 . then ( ( output : any ) => {
105105 let hasWarnings = false ;
106106 if ( output . warnings && output . warnings . length > 0 ) {
0 commit comments