wobsoriano / svelte-clerk

Community Clerk Svelte SDK.
Other
36 stars 4 forks source link

Named export 'createClerkClient' not found #65

Closed Harold-Anderson closed 1 month ago

Harold-Anderson commented 1 month ago

Any idea what I am doing wrong?

% pnpm run build

node:internal/event_target:1094 process.nextTick(() => { throw err; }); ^ file:///C:/Users/H/frontend/.svelte-kit/output/server/chunks/clerkClient.js:1 import { createClerkClient } from "@clerk/backend"; ^^^^^^^^^^^^^^^^^ SyntaxError: Named export 'createClerkClient' not found. The requested module '@clerk/backend' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@clerk/backend'; const { createClerkClient } = pkg;

at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async Promise.all (index 0)
at async analyse (file:///C:/Users/H/frontend/node_modules/.pnpm/@sveltejs+kit@2.7.2_@sveltejs+vite-plugin-svelte@4.0.0_svelte@5.0.4_vite@5.4.9_@types+node@22_6li2rtpd5cmarr4743w73pnnx4/node_modules/@sveltejs/kit/src/core/postbuild/analyse.js:66:16)
at async MessagePort.<anonymous> (file:///C:/Users/H/frontend/node_modules/.pnpm/@sveltejs+kit@2.7.2_@sveltejs+vite-plugin-svelte@4.0.0_svelte@5.0.4_vite@5.4.9_@types+node@22_6li2rtpd5cmarr4743w73pnnx4/node_modules/@sveltejs/kit/src/utils/fork.js:23:16)

Emitted 'error' event on Worker instance at: at [kOnErrorMessage] (node:internal/worker:326:10) at [kOnMessage] (node:internal/worker:337:37) at MessagePort. (node:internal/worker:232:57) at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20) at MessagePort. (node:internal/per_context/messageport:23:28)

wobsoriano commented 1 month ago

Hi, sorry this is happening. I tried a fresh SvelteKit project with default svelte-clerk configs + imported createClerkClient but never ran into that issue. Would you be able to send a basic reproduction?

Thank you

Harold-Anderson commented 1 month ago

Could I ask you to upload an example of how to use the module? That might be quicker than trying to figure out all the mistakes I have made. Something like this, which I was able to build off of.

Harold-Anderson commented 1 month ago

Here is a repository where I tried to use svelte-clerk. I really don't know how to use the components or functions.

wobsoriano commented 1 month ago

Could I ask you to upload an example of how to use the module? That might be quicker than trying to figure out all the mistakes I have made. Something like this, which I was able to build off of.

Will sure do. Didn't expect Svelte to release v5 stable that fast! I'll surely update docs and have some examples.

For now, you can check the React SDK UI components as it is a 1:1 equivalent of the components in svelte-clerk

Harold-Anderson commented 1 month ago

Thank you. I am really unable to figure out how to use it. I've uploaded another attempt, but it is just flailing without documentation and a demo site.

wobsoriano commented 1 month ago

Here is a repository where I tried to use svelte-clerk. I really don't know how to use the components or functions.

I opened a PR for this one with some improvements and test routes

Harold-Anderson commented 1 month ago

Thanks for the pull request. I have merged it. Here is the deployment to Cloudflare Pages https://[82634435.svelte-clerk.pages.dev](https://82634435.svelte-clerk.pages.dev/)/

wobsoriano commented 1 month ago

That's awesome. Im closing this one for now and will be adding docs soon!