chore(shared,react-router,tanstack-start): Create shared environment variable retrieval function#4985
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 71ff504 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
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 |
f607dde to
f756662
Compare
| minify: false, | ||
| sourcemap: true, | ||
| dts: true, | ||
| target: 'es2020', |
There was a problem hiding this comment.
To support import.meta.env, esbuild needs a target of es2020 or above
| @@ -0,0 +1,15 @@ | |||
| --- | |||
| "@clerk/react-router": patch | |||
| "@clerk/shared": minor | |||
There was a problem hiding this comment.
With the introduction of es2020 target, would it make sense to publish a minor version?
LekoArts
left a comment
There was a problem hiding this comment.
Can you publish a snapshot release and test it on the different platforms?
Do you intend to use this shared package in the Next.js SDK in a follow-up?
| @@ -0,0 +1,15 @@ | |||
| --- | |||
| "@clerk/react-router": patch | |||
| "@clerk/shared": minor | |||
Yes I intend to use this on other fullstack SDKs we have. I originally planned on adding Next.js SDK here but there's a blocker here regarding passing Cloudflare context that needs more research. I will do a follow up once resolved 👍🏼 For now I gave the user in that issue a solution that is actually a recommended approach |
|
!snapshot |
|
Hey @wobsoriano - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/astro@2.1.20-snapshot.v20250204165902 --save-exact
npm i @clerk/backend@1.23.12-snapshot.v20250204165902 --save-exact
npm i @clerk/chrome-extension@2.2.7-snapshot.v20250204165902 --save-exact
npm i @clerk/clerk-js@5.52.1-snapshot.v20250204165902 --save-exact
npm i @clerk/elements@0.22.20-snapshot.v20250204165902 --save-exact
npm i @clerk/clerk-expo@2.7.5-snapshot.v20250204165902 --save-exact
npm i @clerk/expo-passkeys@0.1.19-snapshot.v20250204165902 --save-exact
npm i @clerk/express@1.3.47-snapshot.v20250204165902 --save-exact
npm i @clerk/fastify@2.1.20-snapshot.v20250204165902 --save-exact
npm i @clerk/nextjs@6.11.1-snapshot.v20250204165902 --save-exact
npm i @clerk/nuxt@1.1.3-snapshot.v20250204165902 --save-exact
npm i @clerk/clerk-react@5.22.11-snapshot.v20250204165902 --save-exact
npm i @clerk/react-router@1.0.6-snapshot.v20250204165902 --save-exact
npm i @clerk/remix@4.4.22-snapshot.v20250204165902 --save-exact
npm i @clerk/shared@2.21.0-snapshot.v20250204165902 --save-exact
npm i @clerk/tanstack-start@0.9.4-snapshot.v20250204165902 --save-exact
npm i @clerk/testing@1.4.21-snapshot.v20250204165902 --save-exact
npm i @clerk/ui@0.3.21-snapshot.v20250204165902 --save-exact
npm i @clerk/vue@1.1.11-snapshot.v20250204165902 --save-exact |
Tested in a simple app for both Next.js and a Vite Vue app in this repo. They work as expected 🫡 |
LekoArts
left a comment
There was a problem hiding this comment.
Code looks good 👍
One last thing to test would be Expo. We had problems with @clerk/shared in the past with Expo because their Metro bundler is particularly picky about what it supports and what not. Since we don't have E2E tests, just to be sure that it supports es2020 target 🙏
…variable retrieval function (#4985)

Description
This PR introduces an isomorphic environment variable retrieval function that provides consistent config access across Node, Vite and Cloudflare Workers.
Right now it's only implemented in the React Router and TanStack Start SDKs as Next doesn't have a straightforward way of passing cloudflare context. See my comment in a related issue here.
Resolves ECO-302
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change