Skip to content

Commit 9868084

Browse files
authored
fix(localizations): Fix building of retheme subpath exports (#2245)
Before the localizations subpath exports change we had a single entrypoint, the `index`. Based on the CLERK_RETHEME env we were using the index.retheme.ts or the index.ts as entrypoint during build. To support that type of conditional output for all the exported subpaths we need to either define a callback to replace the *.retheme files with the *.ts files or conditional choose them in buiild configuration. Due to some issues with the tsup `onSuccess` callback i manually defined all the subpath exports. We need to be careful in the future and add the new localization files in both package.json#files, tsup.config.ts and in subpaths.mjs file to support subpath exports successfully
1 parent 0d52e23 commit 9868084

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

.changeset/slimy-brooms-smoke.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/localizations/src/index.retheme.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ export { jaJP } from './ja-JP';
1414
export { heIL } from './he-IL';
1515
export { csCZ } from './cs-CZ';
1616
export { zhCN } from './zh-CN';
17+
export { zhTW } from './zh-TW';
1718
export { koKR } from './ko-KR';
1819
export { nbNO } from './nb-NO';
1920
export { viVN } from './vi-VN';
2021
export { plPL } from './pl-PL';
2122
export { elGR } from './el-GR';
2223
export { skSK } from './sk-SK';
2324
export { ukUA } from './uk-UA';
25+
export { roRO } from './ro-RO';

packages/localizations/tsup.config.ts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,35 @@ export default defineConfig(_overrideOptions => {
44
const uiRetheme = process.env.CLERK_RETHEME === '1' || process.env.CLERK_RETHEME === 'true';
55

66
return {
7-
entry: uiRetheme
8-
? ['src', '!src/index.ts', '!src/en-US.ts']
9-
: ['src', '!src/index.retheme.ts', '!src/en-US.retheme.ts'],
7+
entry: {
8+
index: uiRetheme ? 'src/index.retheme.ts' : 'src/index.ts',
9+
'en-US': uiRetheme ? 'src/en-US.retheme.ts' : 'src/en-US.ts',
10+
'ar-SA': 'src/ar-SA.ts',
11+
'cs-CZ': 'src/cs-CZ.ts',
12+
'da-DK': 'src/da-DK.ts',
13+
'de-DE': 'src/de-DE.ts',
14+
'el-GR': 'src/el-GR.ts',
15+
'es-ES': 'src/es-ES.ts',
16+
'fr-FR': 'src/fr-FR.ts',
17+
'he-IL': 'src/he-IL.ts',
18+
'it-IT': 'src/it-IT.ts',
19+
'ja-JP': 'src/ja-JP.ts',
20+
'ko-KR': 'src/ko-KR.ts',
21+
'nb-NO': 'src/nb-NO.ts',
22+
'nl-NL': 'src/nl-NL.ts',
23+
'pl-PL': 'src/pl-PL.ts',
24+
'pt-BR': 'src/pt-BR.ts',
25+
'pt-PT': 'src/pt-PT.ts',
26+
'ro-RO': 'src/ro-RO.ts',
27+
'ru-RU': 'src/ru-RU.ts',
28+
'sk-SK': 'src/sk-SK.ts',
29+
'sv-SE': 'src/sv-SE.ts',
30+
'tr-TR': 'src/tr-TR.ts',
31+
'uk-UA': 'src/uk-UA.ts',
32+
'vi-VN': 'src/vi-VN.ts',
33+
'zh-CN': 'src/zh-CN.ts',
34+
'zh-TW': 'src/zh-TW.ts',
35+
},
1036
format: ['cjs', 'esm'],
1137
bundle: true,
1238
clean: true,

0 commit comments

Comments
 (0)