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

Package is bundled incorrectly causing issues with types / ESM. #5

Closed
mattf96s opened this issue Dec 31, 2023 · 5 comments · Fixed by #6 or #7
Closed

Package is bundled incorrectly causing issues with types / ESM. #5

mattf96s opened this issue Dec 31, 2023 · 5 comments · Fixed by #6 or #7
Labels
question Further information is requested released

Comments

@mattf96s
Copy link

The package is bundled incorrectly which causes an ESM error with the default import or type errors when importing with import { useWorkerFunc } from 'use-react-workers/dist/index.mjs'.

To Reproduce
Visit arethetypeswrong.

Expected behavior
The package is usable within an ESM project without type errors.

@mattf96s mattf96s added the bug Something isn't working label Dec 31, 2023
@jpwallace22 jpwallace22 added question Further information is requested and removed bug Something isn't working labels Dec 31, 2023
@jpwallace22
Copy link
Owner

@mattf96s Thanks for the issue! Couple questions. Why are you importing it from dist/index.mjs like that? If you were to import:

import { useWorkerFunc } from 'use-react-workers`

You would be getting the correct types.

The aretypeswrong indication is that the type declarations don’t represent the runtime JavaScript. This is because the types are generated via a rollup plugin under certain settings, while the JavaScript is generated by another tool entirely, this IS something that can be/will changed but it still wouldn't resolve the issue if you're importing directing from the index.mjs.

@jpwallace22
Copy link
Owner

Issue was autoclosed with merging of possible fix. Reopening until everything can be confirmed.

@jpwallace22
Copy link
Owner

🎉 This issue has been resolved in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rafark
Copy link

rafark commented Jun 6, 2024

🎉 This issue has been resolved in version 1.0.0 🎉

No it has not:

TS2305: Module '"use-react-workers"' has no exported member 'useWorkerFunc'.
    1 | import { Editor, Element, Frame, useEditor, useEditorReturnType, useNode } from "@craftjs/core";
    2 | import { Children, FC, Fragment, ReactNode, isValidElement, useEffect } from "react";
    3 | import {useWorkerFunc} from 'use-react-workers';

@jpwallace22
Copy link
Owner

jpwallace22 commented Jun 23, 2024

@rafark This comment is less than helpful. Are you able to provide a bit more info about your situation/project?

According to the arethetypeswrong link (as well as my testing) they are passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested released
Projects
None yet
3 participants