Skip to content

Commit 7ae2d36

Browse files
committed
fix async error - translations are not emitted
1 parent 18b541e commit 7ae2d36

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,15 @@ export default class I18nextPlugin {
188188
this.prevTimestamps = compilation.fileTimestamps;
189189

190190
try {
191-
await Promise.all(_.map(this.option.languages, lng => {
191+
await Promise.all(_.flatten(_.map(this.option.languages, async lng => {
192192
const resourceTemplate = path.join(this.context, getPath(this.option.resourcePath, lng));
193193
const resourceDir = path.dirname(resourceTemplate);
194194
if (!exists(resourceDir)) {
195195
compilation.missingDependencies.push(resourceDir);
196+
return [];
196197
}
197198

198-
return _.map(this.option.namespaces, async ns => {
199+
return Promise.all(_.map(this.option.namespaces, async ns => {
199200
const resourcePath = getPath(resourceTemplate, undefined, ns);
200201
const outPath = getPath(this.option.outPath, lng, ns);
201202

@@ -211,8 +212,8 @@ export default class I18nextPlugin {
211212
compilation.missingDependencies.push(resourcePath);
212213
compilation.warnings.push(`Can't emit ${outPath}. It looks like ${resourcePath} is not exists.`);
213214
}
214-
});
215-
}));
215+
}));
216+
})));
216217

217218
callback();
218219
} catch (e) {

0 commit comments

Comments
 (0)