Skip to content

Commit 0f31bab

Browse files
committed
use path.resolve, not path.join - possible bug on window
1 parent c979bc4 commit 0f31bab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export default class I18nextPlugin {
208208

209209
try {
210210
await Promise.all(_.flatten(_.map(this.option.languages, async lng => {
211-
const resourceTemplate = path.join(this.context, getPath(this.option.resourcePath, lng));
211+
const resourceTemplate = path.resolve(this.context, getPath(this.option.resourcePath, lng));
212212
const resourceDir = path.dirname(resourceTemplate);
213213
if (!exists(resourceDir)) {
214214
compilation.missingDependencies.push(resourceDir);
@@ -253,7 +253,7 @@ export default class I18nextPlugin {
253253
// write missing
254254
await this.initMissingDir();
255255
await Promise.all(_.map(this.missingKeys, async (namespaces, lng) => {
256-
const resourceTemplate = path.join(this.context, getPath(this.option.pathToSaveMissing, lng));
256+
const resourceTemplate = path.resolve(this.context, getPath(this.option.pathToSaveMissing, lng));
257257
const resourceDir = path.dirname(resourceTemplate);
258258
try {
259259
await mkdir(resourceDir);
@@ -274,7 +274,7 @@ export default class I18nextPlugin {
274274
stream.write(_.map(
275275
keys,
276276
key => `\t"${key}": [\n${_.map(
277-
values[key], (pos, module) => `\t\t"${_.trim(JSON.stringify(path.relative(this.context, module)), '"')}(${pos})"`).join("\n")
277+
values[key], (pos, module) => `\t\t"${_.trim(JSON.stringify(path.relative(this.context, module)), '"')}(${pos})"`).join(",\n")
278278
}\n\t]`).join(",\n")
279279
);
280280
stream.end("\n}");
@@ -286,7 +286,7 @@ export default class I18nextPlugin {
286286
// remove previous missings
287287
await Promise.all(_.map(remains, async (namespaces, lng) =>
288288
_.map(namespaces, async (__, ns) => {
289-
const missingPath = path.join(this.context, getPath(this.option.pathToSaveMissing, lng, ns));
289+
const missingPath = path.resolve(this.context, getPath(this.option.pathToSaveMissing, lng, ns));
290290
if (await exists(missingPath)) {
291291
await unlink(missingPath);
292292
}

0 commit comments

Comments
 (0)