-
Couldn't load subscription status.
- Fork 402
Description
Preliminary Checks
-
I have reviewed the documentation: https://clerk.com/docs
-
I have searched for existing issues: https://github.com/clerk/javascript/issues
-
I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
-
This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction
https://github.com/markjanzer/clerk-fastify-tsx-issue
Publishable key
pk_test_a25vd2luZy1sZW11ci0zMC5jbGVyay5hY2NvdW50cy5kZXYk
Description
@clerk/fastify cannot be imported using static imports when running TypeScript files with tsx.
Note: This issue appears to have been introduced in v2.0 - v1.0 worked fine with tsx.
Steps to reproduce:
- Clone repo: https://github.com/[your-username]/clerk-fastify-tsx-issue
- Run
npm install && npm test
Expected behavior:
Static imports should work with tsx (like they do with Node.js and with @clerk/backend)
Actual behavior:
npx tsx test-file.ts
# Error: SyntaxError: The requested module '@clerk/fastify' does not provide an export named 'clerkPlugin'Root cause:
The ESM bundle is minified (export{S as clerkPlugin}), which breaks tsx's static import analysis. @clerk/backend ships non-minified ESM and works fine.
Environment
System:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M1 Pro
Memory: 298.63 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.18.0 - /opt/homebrew/opt/node@22/bin/node
Yarn: 1.22.22 - /Users/markjanzer/.yarn/bin/yarn
npm: 10.9.3 - /opt/homebrew/opt/node@22/bin/npm
pnpm: 10.15.0 - /opt/homebrew/bin/pnpm
Browsers:
Chrome: 141.0.7390.76
Safari: 17.6
npmPackages:
@clerk/backend: ^1.0.0 => 1.34.0
@clerk/fastify: ^2.0.0 => 2.4.37
@types/node: ^20.10.0 => 20.19.21
fastify: ^5.6.1 => 5.6.1
tsx: ^4.7.0 => 4.20.6
typescript: ^5.3.3 => 5.9.3