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

feat(localizations): Allow the usage of subpath imports #2046

Closed
wants to merge 5 commits into from

Conversation

MonsterDeveloper
Copy link
Contributor

Description

The localizations package now allows for subpath exports.

- import { frFR } from "@clerk/localizations"
+ import { frFR } from "@clerk/localizations/fr-FR"

This should help with tree-shaking by helping the bundler to include only specific localization.

This is a non-breaking change-previous imports from @clerk/localizations are still working as expected.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/backend
  • @clerk/chrome-extension
  • @clerk/clerk-js
  • @clerk/clerk-expo
  • @clerk/fastify
  • gatsby-plugin-clerk
  • @clerk/localizations
  • @clerk/nextjs
  • @clerk/clerk-react
  • @clerk/remix
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/themes
  • @clerk/types
  • build/tooling/chore

@MonsterDeveloper MonsterDeveloper requested a review from a team as a code owner November 5, 2023 22:18
Copy link

changeset-bot bot commented Nov 5, 2023

🦋 Changeset detected

Latest commit: 93595d4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@clerk/localizations Patch
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@LekoArts
Copy link
Member

Hey Andrew, thanks for the PR!

Seems like a good change, however we'll need to test this a bit more since we have made the experience in the past (with the revamped @clerk/shared package) that certain bundlers (like Metro bundler of Expo) have problems with subpath imports. It's annoying but we'd need to check if in that environment it continues to work as expected.

https://github.com/clerk/clerk-expo-starter should be a good starting ground to test. I won't get to testing this today and will be on vacation soon, I'll make sure to hand this PR off to a colleague then.

@MonsterDeveloper
Copy link
Contributor Author

Thanks @LekoArts, looking forward to getting this merged. Let me know if I can help you with the testing.

@MonsterDeveloper
Copy link
Contributor Author

Hey! Any ETA on this one? localizations still occupy almost 1 MB (more than a half) of my bundle😔

CleanShot 2023-11-24 at 11 13 19

dimkl added a commit that referenced this pull request Nov 29, 2023
The addition of `.gitignore` and `subpaths.mjs` is used to support
Expo framework. This fix is also used in `@clerk/shared` package.

original PR: #2046

Co-authored-by: MonsterDeveloper
dimkl added a commit that referenced this pull request Nov 29, 2023
The addition of `.gitignore` and `subpaths.mjs` is used to support
Expo framework. This fix is also used in `@clerk/shared` package.

original PR: #2046

Co-authored-by: Andrew <[email protected]>
@dimkl
Copy link
Contributor

dimkl commented Nov 29, 2023

Hello @MonsterDeveloper 👋 ,
I have created another PR and added a fix for Expo framework. I have added you as co-author since you did the original work. I will close the this one in favor of #2236

@dimkl dimkl closed this Nov 29, 2023
dimkl added a commit that referenced this pull request Nov 29, 2023
The addition of `.gitignore` and `subpaths.mjs` is used to support
Expo framework. This fix is also used in `@clerk/shared` package.

original PR: #2046

Co-authored-by: Andrew <[email protected]>
@MonsterDeveloper
Copy link
Contributor Author

Thanks @dimkl ! Looking forward to getting this new PR merged.

github-merge-queue bot pushed a commit that referenced this pull request Nov 30, 2023
* feat(localizations): Allow usage of subpath exports

The addition of `.gitignore` and `subpaths.mjs` is used to support
Expo framework. This fix is also used in `@clerk/shared` package.

original PR: #2046

Co-authored-by: Andrew <[email protected]>

* update changeset

---------

Co-authored-by: Andrew <[email protected]>
Co-authored-by: Lennart <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants