Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Universal import support #941

Closed
wants to merge 3 commits into from
Closed

Universal import support #941

wants to merge 3 commits into from

Conversation

claabs
Copy link

@claabs claabs commented Feb 26, 2024

This should hopefully address the hell that is universal compatibility across all JS ecosystems, versions, and bundlers.
Resolves #940

Here's a bunch of resources that I utilized to come to this solution:

To verify the exports are okay, I ran

npm run build
npx attw
npx publint

All turned up with no problems.

I tested with ESM Node and Typescript, but CJS Node and browser imports should be tested to ensure no breaking changes.

@claabs claabs requested a review from a team as a code owner February 26, 2024 02:09
@claabs
Copy link
Author

claabs commented Feb 26, 2024

Oof, this may break default import behavior (in Typescript at least).

This worked before:

import CancelablePromise from 'cancelable-promise';
CancelablePromise.cancelable

But after this PR, it throws:

Property 'cancelable' does not exist on type 'typeof CancelablePromise'. Did you mean 'isCancelable'? ts(2551)

This is likely a breaking change then.

@kostia1st
Copy link

@claabs is this PR mergable now?

I have multiple issues with this lib in heterogenous workspace (used from CommonJS and ESM). This PR might solve all of those.

@claabs
Copy link
Author

claabs commented Jul 22, 2024

@claabs is this PR mergable now?

I have multiple issues with this lib in heterogenous workspace (used from CommonJS and ESM). This PR might solve all of those.

I don't have the highest confidence. For my project, I ended up switching to the p-cancelable package in lieu of this.

@Sacadura Sacadura closed this Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Cannnot use named import in an ESM project
3 participants