Skip to content

Commit

Permalink
fix(cli): Ignore empty values
Browse files Browse the repository at this point in the history
For some reason, certain machines register an empty directory when scanning only files. These simple checks make sure we don't confuse bundlers with empty imports.
  • Loading branch information
Pkmmte committed Oct 13, 2022
1 parent 334710e commit 1206d20
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ const start = async () => {

// Each locale in the store will get its own case + nested switch
for (const locale in store) {
if (!locale.trim()) continue;
data +=
`\t\tcase '${locale}':\n` +
`\t\t\tswitch (ns) {\n`;

for (const ns of store[locale]) {
if (!ns.trim()) continue;
data +=
`\t\t\t\tcase '${ns}':\n` +
`\t\t\t\t\treturn import('./locales/${locale}/${ns}.json');\n`;
Expand Down

0 comments on commit 1206d20

Please sign in to comment.