@@ -116,56 +116,56 @@ class ChildProcessWebpackPlugin {
116116
117117 const plugin = { name : "ExecaPlugin" } ;
118118
119- const compileFn = ( ) => {
120- if ( this . options . onBuildStart . length > 0 ) {
119+ if ( this . options . onBuildStart . length > 0 ) {
120+ const compileFn = ( ) => {
121121 this . execute ( this . options . onBuildStart ) ;
122122
123123 if ( this . options . dev ) {
124124 this . options . onBuildStart = [ ] ;
125125 }
126- }
127- } ;
126+ } ;
128127
129- if ( compiler . hooks ) {
130- // Information: `beforeRun.asyncTap` in future major
131- compiler . hooks . compile . tap ( plugin , compileFn ) ;
132- } else {
133- compiler . plugin ( "compile" , compileFn ) ;
128+ if ( compiler . hooks ) {
129+ // Information: `beforeRun.asyncTap` in future major
130+ compiler . hooks . compile . tap ( plugin , compileFn ) ;
131+ } else {
132+ compiler . plugin ( "compile" , compileFn ) ;
133+ }
134134 }
135135
136- const afterEmitFn = ( compilation , callback ) => {
137- if ( this . options . onBuildEnd . length > 0 ) {
136+ if ( this . options . onBuildEnd . length > 0 ) {
137+ const afterEmitFn = ( compilation , callback ) => {
138138 this . execute ( this . options . onBuildEnd ) ;
139139
140140 if ( this . options . dev ) {
141141 this . options . onBuildEnd = [ ] ;
142142 }
143- }
144143
145- callback ( ) ;
146- } ;
144+ callback ( ) ;
145+ } ;
147146
148- if ( compiler . hooks ) {
149- compiler . hooks . afterEmit . tapAsync ( plugin , afterEmitFn ) ;
150- } else {
151- compiler . plugin ( "after-emit" , afterEmitFn ) ;
147+ if ( compiler . hooks ) {
148+ compiler . hooks . afterEmit . tapAsync ( plugin , afterEmitFn ) ;
149+ } else {
150+ compiler . plugin ( "after-emit" , afterEmitFn ) ;
151+ }
152152 }
153153
154- const doneFn = ( ) => {
155- if ( this . options . onBuildExit . length > 0 ) {
154+ if ( this . options . onBuildExit . length > 0 ) {
155+ const doneFn = ( ) => {
156156 this . execute ( this . options . onBuildExit ) ;
157157
158158 if ( this . options . dev ) {
159159 this . options . onBuildExit = [ ] ;
160160 }
161- }
162- } ;
161+ } ;
163162
164- if ( compiler . hooks ) {
165- // Information: `asyncTap` in future major
166- compiler . hooks . done . tap ( plugin , doneFn ) ;
167- } else {
168- compiler . plugin ( "done" , doneFn ) ;
163+ if ( compiler . hooks ) {
164+ // Information: `asyncTap` in future major
165+ compiler . hooks . done . tap ( plugin , doneFn ) ;
166+ } else {
167+ compiler . plugin ( "done" , doneFn ) ;
168+ }
169169 }
170170 }
171171}
0 commit comments