stripe-node icon indicating copy to clipboard operation
stripe-node copied to clipboard

NPM module alias doesn't allow for module type resolution.

Open Jackson-clipboard opened this issue 7 months ago • 1 comments

Describe the bug

If we use an alias for stripe via npm: npm i stripe-18@npm:[email protected]

We are unable to resolve the index.d.ts as a module, although its present within our node modules folder.

To Reproduce

  1. run npm i stripe-18@npm:[email protected]
  2. Within a .ts file that has access to the node_modules resources: import Stripe from 'stripe-18';

This will result in the error: File '.../node_modules/stripe-18/types/index.d.ts' is not a module.

Expected behavior

We would expect that the module would be able to be resolved via the alias.

Code snippets

npm i stripe-18@npm:[email protected]
import Stripe from 'stripe-18'

OS

macOS

Node version

Node v18.16.1

Library version

stripe-node v18.0.0

API version

2025-03-31.basil

Additional context

No response

Jackson-clipboard avatar Apr 03 '25 04:04 Jackson-clipboard

Is this a regression from v17 or is this a feature that's never worked?

xavdid-stripe avatar Apr 04 '25 17:04 xavdid-stripe

I think it never worked. Stripe is declaring the module as declare module 'stripe', so if you install as an alias, the directory name will not match the module name and this will fail

figassis avatar Sep 08 '25 11:09 figassis

This is on our radar to fix. Unfortunately, it's behind a lot of refactoring work, so we can't commit to a timeline when it'll be fixed.

xavdid-stripe avatar Sep 16 '25 17:09 xavdid-stripe