#trollboy
1 messages · Page 1 of 1 (latest)
hello! i'm not familiar at all with sveltejs, but what updates did you make?
upgraded stripe-svelte
import Stripe from 'stripe'
when uncommented gives me:
ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/home/node/app/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///home/node/app/public/server/chunks/_server-5d526f44.js:2181:3
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:528:24)
at async resolve (file:///home/node/app/public/server/chunks/index-19e3e44c.js:2976:52)
at async Object.handle (file:///home/node/app/public/server/chunks/hooks.server-8b9da1b3.js:8:20)
at async respond (file:///home/node/app/public/server/chunks/index-19e3e44c.js:3016:22)
at async Array.ssr (file:///home/node/app/public/handler.js:16060:3)
i'm afraid stripe-svelte is developed and maintained by a third party, and not by Stripe. I'd suggest reaching out to the maintainers of that repo for help.
when I updated stripe-svelte, it updated all the dev dependencies. including the official stripe npm package is causing the error
and here's the offending code in the official stripe package causing the error:
https://github.com/stripe/stripe-node/blob/master/src/utils.ts#L10
what it sounds like to me is that it's conflicting with something in your stripe-svelte package. if you can give me a simple project that replicates the issue without using stripe-svelte, I'll be able to look into this further. I'm currently not able to reproduce it unfortunately.