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

Invalid imports when types are exported from a different location than the js #608

Open
steinybot opened this issue Mar 4, 2024 · 0 comments

Comments

@steinybot
Copy link
Contributor

There is at least one problem when ST converts something like https://www.npmjs.com/package/react-error-boundary.

It has the following layout:
Screenshot 2024-03-04 at 2 43 14 PM

ST ends up generating this:

    @JSImport("react-error-boundary/dist/declarations/src/ErrorBoundary", "ErrorBoundary")
    @js.native
    val component: js.Object = js.native

This will fail as there is no module at react-error-boundary/dist/declarations/src/ErrorBoundary.

Trying to workaround it using alias from webpack is problematic too since there is no way to convert everything under react-error-boundary/dist/declarations/src to a single module react-error-boundary. I'm pretty sure I have to list every file one by one.

I'm not entirely sure how this should be reconciled but it needs to do something different.

dist/react-error-boundary.cjs.d.ts has:

export * from "./declarations/src/index";
//# sourceMappingURL=react-error-boundary.cjs.d.ts.map

So any imports cannot use ./declarations/src/index that's for sure.

So should everything be rebased onto the main entry point?

They also need to match the exports although perhaps that will be right if we get the first part right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant