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).
Summary
Silences the Vite
configLoader: 'native'deprecation warnings that surfaced when runningpnpm test/pnpm test:dev:No behavior change — purely config/tooling cleanup.
Changes
*.config.tsfiles (andpackages/design-token-ts-plugin/vitest.config.ts) to.mts, since the nearestpackage.jsonhas no"type"field and Node/Vite resolve.tsas CommonJS by default:vitest.config.mtsvitest.dev.config.mtsvitest.scripts.config.mtspackages/design-token-ts-plugin/vitest.config.mtspackage.jsontest:dev/test:storybook:devscripts,projectsarrays, and comments."type": "module"topackages/i18n/package.json, matchingpackages/nimbusandpackages/nimbus-mcp. It's an internal build tool only ever invoked viatsx(unaffected by"type") or imported from a Vite config loader, so this is safe..tsextensions to the now-flagged relative imports inpackages/nimbus's vite/vitest configs (allowImportingTsExtensionsis already enabled intsconfig.json).docs/file-type-guidelines/unit-testing.mdto reference the renamed root orchestrator file.Verification
pnpm test:devand theunit/unit-isolated/ts-plugin/nimbus-mcp/scriptsprojects all pass (1690+ tests), with noconfigLoader: 'native'warnings.pnpm --filter @commercetools/nimbus typecheck:devpasses.Not in scope
plans/full-mcp-ui-workflow/ssr/SSR_IMPLEMENTATION.mdstill references the pre-renamevitest.config.tsfilename — it's a standalone planning doc, not a maintained guideline, so left untouched.docs/file-type-guidelines/unit-testing.md's root-orchestrator example only lists 2 of the now 6 projects — pre-existing drift unrelated to this change, not fixed here.