import { Compiler , Configuration } from 'webpack' ; const defaultOptions = { } ; interface DoneOptions { done : ( option : Configuration ) => void ; } export class DonePlugin { private options : DoneOptions ; public constructor ( options ) { this . options = { ... defaultOptions , ... options } ; } public apply ( compiler ) { if ( compiler . hooks ) { compiler . hooks . done . tap ( 'DonePlugin' , ( data ) => { this . options . done && this . options . done ( compiler . options ) ; return data ; } ) ; } else { compiler . plugin ( 'done' , ( data ) => { this . options . done && this . options . done ( compiler . options ) ; return data ; } ) ; } } }