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. diff --git a/packages/localizations/package.json b/packages/localizations/package.json index 25a758c9a6b..3dca36bf22a 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, }; });