Skip to content

fix: TypeScript 6 defaults module to "esnext"#791

Open
koglerch13 wants to merge 1 commit intocodingcommons:mainfrom
koglerch13:main
Open

fix: TypeScript 6 defaults module to "esnext"#791
koglerch13 wants to merge 1 commit intocodingcommons:mainfrom
koglerch13:main

Conversation

@koglerch13
Copy link
Copy Markdown

@koglerch13 koglerch13 commented Apr 28, 2026

TypeScript 6 changed the default module to "esnext" (previously it was CommonJS) - reference: https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/

In our setup, we imported another file in our /en/index.ts file:

import en from './en';
export default en;

after upgrading to TypeScript 6, generating the language files failed.
More details can be found in the corresponding issue: #789

The fix sets the module option to use CommonJS (which was used implicitly before anyway).

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time.
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint

generator

If you change something in the generator, please also:

  • add some snapshot tests to the packages/generator/test/generator.test.ts-file
  • then run pnpm test => you should see your tests failing
  • run pnpm test:update-generated-files
  • again run pnpm test => your tests should pass
  • then add all the created *.expected.*-files to the git-index and
  • make sure these files look like you would expect them
  • finally commit these files to the repository

This causes some imports to fail (see codingcommons#789).

The fix sets the module option to use CommonJS (which was used implicitly before anyway).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant