From fb65976acb1003f441a35afafbd87204eca0e2d7 Mon Sep 17 00:00:00 2001 From: DivisionByZero Date: Thu, 11 Apr 2024 08:33:15 +0200 Subject: fix: tree-shaking (#2790) Co-authored-by: ST-DDT --- scripts/generate-locales.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/generate-locales.ts b/scripts/generate-locales.ts index cba70edc..67b48553 100644 --- a/scripts/generate-locales.ts +++ b/scripts/generate-locales.ts @@ -375,7 +375,7 @@ removeIndexTs(locales); let localeIndexImports = ''; let localeIndexExportsIndividual = ''; let localeIndexExportsGrouped = ''; -let localesIndexExports = ''; +let localesIndexImports = ''; let localizationLocales = '| Locale | Name | Faker |\n| :--- | :--- | :--- |\n'; @@ -406,7 +406,7 @@ for (const locale of locales) { localeIndexImports += `import { faker as ${localizedFaker} } from './${locale}';\n`; localeIndexExportsIndividual += ` ${localizedFaker},\n`; localeIndexExportsGrouped += ` ${locale}: ${localizedFaker},\n`; - localesIndexExports += `export { default as ${locale} } from './${locale}';\n`; + localesIndexImports += `import { default as ${locale} } from './${locale}';\n`; localizationLocales += `| \`${locale}\` | ${localeTitle} | \`${localizedFaker}\` |\n`; // src/locale/.ts @@ -445,7 +445,11 @@ writeFileSync(pathLocaleIndex, localeIndexContent); let localesIndexContent = ` ${autoGeneratedCommentHeader} - ${localesIndexExports} + ${localesIndexImports} + + export { ${locales.join(',')} }; + + export const allLocales = { ${locales.join(',')} }; `; localesIndexContent = await formatTypescript(localesIndexContent); -- cgit v1.2.3