Skip to content

Commit 524600b

Browse files
committed
fix(cli): wxa file import other source file should rename to target wxa filename
1 parent 5de7216 commit 524600b

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

packages/wxa-cli/src/compilers/wxa.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff 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

packages/wxa-cli/src/optimizer/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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) {

packages/wxa-cli/src/schedule.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)