File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -113,12 +113,10 @@ export default class WxaCompiler {
113113 } ) ;
114114 }
115115
116- if ( ! rstTypeObject . src ) {
117- let opath = path . parse ( filepath ) ;
118-
119-
120- rstTypeObject . src = opath . dir + path . sep + opath . name + '.' + rstTypeObject . type ;
121- }
116+ // if (!rstTypeObject.src) {
117+ // }
118+ let opath = path . parse ( filepath ) ;
119+ rstTypeObject . src = opath . dir + path . sep + opath . name + '.' + rstTypeObject . type ;
122120
123121 rstTypeObject . $from = filepath ;
124122
Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ export default class Optimizer {
3737 }
3838
3939 async do ( dep , indexedMap ) {
40+ if ( ! dep . src ) {
41+ // deadcode normally
42+ debugger ;
43+ return ;
44+ }
4045 const text = path . relative ( this . cwd , dep . src ) ;
4146 this . progress . draw ( text , 'Optimizing' , ! this . cmdOptions . verbose ) ;
4247 switch ( this . wxaConfigs . target ) {
Original file line number Diff line number Diff line change @@ -118,12 +118,12 @@ class Schedule {
118118
119119 async $doDPA ( ) {
120120 let tasks = [ ] ;
121- // while (this.$depPending.length) {
121+ while ( this . $depPending . length ) {
122122 let dep = this . $depPending . shift ( ) ;
123123
124124 // debug('file to parse %O', dep);
125125 tasks . push ( this . $parse ( dep ) ) ;
126- // }
126+ }
127127
128128 let succ = await Promise . all ( tasks ) ;
129129
@@ -331,7 +331,7 @@ class Schedule {
331331 child = indexedModule ;
332332 }
333333
334- if ( child . color !== COLOR . COMPILED ) this . $depPending . push ( child ) ;
334+ if ( ~ [ COLOR . CHANGED , COLOR . COMPILE_ERROR , COLOR . INIT ] . indexOf ( child . color ) ) this . $depPending . push ( child ) ;
335335 if ( child . color === COLOR . INIT ) this . $indexOfModule . set ( child . src , child ) ;
336336
337337 return child ;
You can’t perform that action at this time.
0 commit comments