You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When I was trying out the Web SDK (@corbado/web-js) it could not transpile because Corbado is not an ESM module. I receive the following error:
(node:25781) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
6:36:31 PM [vite] Error when evaluating SSR module /src/routes/+page.svelte: failed to import "@corbado/web-js"
|- /Users/fohlen/WebstormProjects/lesstax/node_modules/@corbado/web-js/dist/index.js:1
This is tailed by a long backtrace but boils down to using ESM.
To Reproduce
Steps to reproduce the behavior:
Use Node 22, e.g 22.2.0 which is the latest via brew install node
Create a Svelte project via npm create svelte@latest
@Fohlen thanks for reporting. Unfortunately we can't just switch web-js to a ESM module. Most likely we have to support both (esm and cjs) for some time. So this requires a bit of time and I have put this request on our roadmap.
Describe the bug
When I was trying out the Web SDK (
@corbado/web-js
) it could not transpile because Corbado is not an ESM module. I receive the following error:This is tailed by a long backtrace but boils down to using ESM.
To Reproduce
Steps to reproduce the behavior:
22.2.0
which is the latest viabrew install node
npm create svelte@latest
npm install --save @corbado/web-js
import Corbado from '@corbado/web-js'
npm run dev
Expected behavior
It should build in Node 22.
Additional context
According to StackOverflow, simply declaring the package type as:
Should do the trick. Alternatively, declaring the output as
.mjs
will make it obvious for Node.js to pick up that it should use ESM over CommonJS.The text was updated successfully, but these errors were encountered: