Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Change imports to use .js to make them compatible with eslint-plugin-import (#1667) #1667

Merged
merged 3 commits into from
Jan 24, 2025

Conversation

DuckThom
Copy link

@amannn Following our conversation on X, these are the changes that I've made that appear to be fixing the imports when the import/named ESLint rule is used.

As mentioned before, I also took the liberty of adding the ESLint rule 'import/extensions': 'error' to ensure the right extensions are used in the import/export statements. For context, when compiling to ESM modules, TS copies over the import/export statements as-is, so during development, runtime compatible file extensions must be used.

For local testing I ran a build and then manually copied over the dist folder into node_modules/next-intl in my other project.

Copy link

vercel bot commented Jan 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-intl-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2025 10:03am
next-intl-example-app-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2025 10:03am
next-intl-example-app-router-without-i18n-routing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2025 10:03am

Copy link

vercel bot commented Jan 17, 2025

@DuckThom is attempting to deploy a commit to the next-intl Team on Vercel.

A member of the Team first needs to authorize it.

- Forces VSCode to import files following the "module" rule in tsconfig.
  For ESM emits .js must always be used in imports.
Copy link
Owner

@amannn amannn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for your help here @DuckThom!

packages/next-intl/src/index.react-client.tsx Show resolved Hide resolved
@amannn amannn changed the title fix: change imports to use .js to make them esm compatible fix: Change imports to use .js to make them compatible with eslint-plugin-import (#1667) Jan 24, 2025
@amannn amannn merged commit 5b218d4 into amannn:v4 Jan 24, 2025
7 checks passed
@amannn
Copy link
Owner

amannn commented Jan 24, 2025

@DuckThom Just tried this in your reproduction:

Screenshot 2025-01-24 at 11 21 27

👏👏👏

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.

2 participants