From 9be28750864c41fb034c62ba8cc8038b9bbff946 Mon Sep 17 00:00:00 2001 From: Andrei Bobkov Date: Sun, 5 Nov 2023 23:05:45 +0100 Subject: [PATCH 1/2] feat(localizations): Allow the usage of subpath imports --- packages/localizations/package.json | 14 ++++++++++++-- packages/localizations/tsup.config.ts | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/localizations/package.json b/packages/localizations/package.json index 8a653f2322d..23c9168e8a6 100644 --- a/packages/localizations/package.json +++ b/packages/localizations/package.json @@ -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" ], diff --git a/packages/localizations/tsup.config.ts b/packages/localizations/tsup.config.ts index d4533b9715c..1ec5199ced8 100644 --- a/packages/localizations/tsup.config.ts +++ b/packages/localizations/tsup.config.ts @@ -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, }; }); From 1af3693d3f38ee579a7fb2560dcb011edc869d4b Mon Sep 17 00:00:00 2001 From: Andrei Bobkov Date: Sun, 5 Nov 2023 23:15:40 +0100 Subject: [PATCH 2/2] chore(repo): Add a changeset --- .changeset/late-insects-kick.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .changeset/late-insects-kick.md diff --git a/.changeset/late-insects-kick.md b/.changeset/late-insects-kick.md new file mode 100644 index 00000000000..4d9409d4b64 --- /dev/null +++ b/.changeset/late-insects-kick.md @@ -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.