stripe / stripe-node

Node.js library for the Stripe API.
https://stripe.com
MIT License
3.9k stars 755 forks source link

Resolution for worker and other modules fails #2037

Closed manzoorwanijk closed 8 months ago

manzoorwanijk commented 8 months ago

Describe the bug

If you try to use import Stripe from 'stripe/worker';, it throws an error, Cannot resolve dependency 'stripe/worker'

There are also some other TS types problems - https://arethetypeswrong.github.io/?p=stripe%4014.20.0

To Reproduce

Expected behavior

The module should resolve correctly

Code snippets

import { Stripe } from "stripe/worker";

export const stripe = new Stripe("key_here", {
  appInfo: {
    name: "stripe-samples/link-with-stripe",
    version: "0.0.1",
    url: "https://github.com/stripe-samples/link-with-stripe",
  },
});

OS

macOS

Node version

v18.19.0

Library version

^14.20.0

API version

2023-10-16

Additional context

No response

anniel-stripe commented 8 months ago

Hi! import Stripe from 'stripe/worker'; is not a supported way of importing from Stripe. stripe does not export any submodules (see our package.json export map). We do export a different version of the package in worker environments, but the import shouldn't need changing.

anniel-stripe commented 8 months ago

~For the types issues, can you provide more details? I went to https://arethetypeswrong.github.io/?p=stripe%4014.20.0 but am not sure what to look for.~

Ah, I see, the problem is described in https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md

ramya-stripe commented 8 months ago

Hey @manzoorwanijk

Is the types issue of Masquerading as CJS causing any problems in your integration at the moment?

manzoorwanijk commented 8 months ago

Is the types issue of Masquerading as CJS causing any problems in your integration at the moment?

No

ramya-stripe commented 8 months ago

In that case, we will close this issue and add the investigation of that issue to our backlog