Commit 8c66968
committed
fix(i18n): fix CI build breakage from prior commit
The previous commit added "type": "module" to packages/i18n/package.json
to silence a Vite native configLoader warning about ESM syntax loaded
as CommonJS. That broke this package's build pipeline: its tsx-invoked
scripts (build:split, build:compile-strings, build:dictionaries) use
CommonJS __dirname without an ESM fallback, and tsx treats a file as
ESM once the nearest package.json sets "type": "module". Every script
failed with `ReferenceError: __dirname is not defined`, no *.messages.ts
files got generated, and packages/nimbus's build then failed with
~36 "Cannot find module '*.messages'" errors.
Fix by reverting the package-wide "type": "module" and instead
renaming just the offending file to locales.mts (same approach already
used for the root-level vitest configs), which makes Vite's native
config loader treat it as ESM without touching how tsx resolves every
other file in the package. Updated the file's extensionless importers
(compile-component-messages.ts, extract-messages.ts,
generate-dictionaries.ts, split-by-component.ts) to the explicit
.mts extension, since tsx's CJS-mode resolver doesn't probe for .mts
on extensionless specifiers. Also updated the one cross-package import
in packages/nimbus/vite.config.ts and doc references
(packages/i18n/CLAUDE.md, packages/i18n/README.md).
Verified: pnpm --filter @commercetools/nimbus-i18n build succeeds,
pnpm --filter @commercetools/nimbus build succeeds (the exact command
that failed in CI), and the unit/unit-isolated/ts-plugin/nimbus-mcp/
scripts vitest projects all pass (2019 tests).1 parent 8a5c29b commit 8c66968
9 files changed
Lines changed: 10 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
0 commit comments