Skip to content

Commit

Permalink
chore: fix in vite
Browse files Browse the repository at this point in the history
  • Loading branch information
hexf00 committed Nov 11, 2024
1 parent 9c29255 commit 58cd859
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/core/src/export-virtual-locales-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ export function exportVirtualLocalesModule() {

const key = `${generateRandomString(8)}${langVar}`
// if version is greater than 0.5.0, use lib/es/locale
const localePath = fs.existsSync(path.resolve('node_modules', packageName, 'lib/es/locale', `${lang}.js`))
? 'lib/es/locale'
: 'lib/locale'
importStatement += `import ${key} from '${packageName}/${localePath}/${lang}';\n`
const isNewVersion = fs.existsSync(path.resolve('node_modules', packageName, 'lib/es/locale', `${lang}.js`))
const localePath = isNewVersion ? 'lib/es/locale' : 'lib/locale'
if (isNewVersion) {
importStatement += `import ${key} from '${packageName}/${localePath}/${lang}.j';\n`

Check warning on line 42 in packages/core/src/export-virtual-locales-module.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/export-virtual-locales-module.ts#L42

Added line #L42 was not covered by tests
} else {
importStatement += `import ${key} from '${packageName}/${localePath}/${lang}';\n`
}
languages[lang].add(key)
}
})
Expand Down

0 comments on commit 58cd859

Please sign in to comment.