Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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/locale #65
Feat/locale #65
Changes from all commits
1988765
4b161ee
5371c2f
02c3171
f1e60c4
9b5a7f6
2ab0645
f3f8459
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you verify it works with web bundlers such as Wepback, please? I' suggesting to build the library and
npm link
todist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked for webpack, it gave error for missing entry of
.
in exports, so added that and it worked fine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this approach because you're referring only to cjs modules here, and web bundles can't tree-shake it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other approach could be to have package.json for each language, and it contains
main
andmodule
entries in it and removeexports
from main package.json. Should I check that? We will need to take care that users still need to only install main package only.Or can we use other builder than rollup? Like node? Which supports multiple entry points: https://nx.dev/node/build#additionalentrypoints. And it's built on top of webpack, which can help us with more configurations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not an issue because it's tree-shakable. It'll not be bundled if they do not use the i18n functions.
There's a problem we did not think of - name collision. We should prefix the i18n function with the locale (e.g.
ruRandFullName)
Let's try the other builder with the entry point support regarding the build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the prefix in place, we can just export the i18n functions in the regular index.ts file, right? 🤔 No additional entry point is needed for packaging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaelxvoelker feel free to clone the repo or even the branch I created and try out what you mentioned. Let me know if it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried node builder, but doesn't produce results the way we want. I will research more.