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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/late-insects-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@clerk/localizations': patch
---

The package now allows for [subpath exports](https://nodejs.org/api/packages.html#subpath-exports).

```diff
- 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.
14 changes: 12 additions & 2 deletions packages/localizations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@
"license": "MIT",
"author": "Clerk",
"sideEffects": false,
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts"
},
"./*": {
"require": "./dist/*.js",
"import": "./dist/esm/*.js",
"types": "./dist/types/*.d.ts"
}
},
"main": "./dist/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"files": [
"dist"
],
Expand Down
3 changes: 2 additions & 1 deletion packages/localizations/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ export default defineConfig(overrideOptions => {
const isProd = overrideOptions.env?.NODE_ENV === 'production';

return {
entry: ['src/index.ts'],
entry: ['./src/*.{ts,tsx}'],
onSuccess: 'tsc',
minify: isProd,
clean: true,
sourcemap: true,
format: ['cjs', 'esm'],
legacyOutput: true,
splitting: false,
};
});