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

Building with hotscript as dependency #80

Open
dkzlv opened this issue Mar 16, 2023 · 5 comments
Open

Building with hotscript as dependency #80

dkzlv opened this issue Mar 16, 2023 · 5 comments

Comments

@dkzlv
Copy link

dkzlv commented Mar 16, 2023

Hey there! Thanks for the repo, it's very nice, just as your course (passed it and liked a lot!).

We at Evil Martians have plans to extend our nanostores ecosystem with a form library called nanoform. And for it we wanted to make a map store that will provide typesafe object path interface for the underlying structure. That's where we use Objects.Get and Objects.AllPaths utilities.

It works perfectly from the DX point of view, but we have an issue when building the lib. It's probably not hotscript specific, but I hoped you could give any guidance on how to fix that.

Here's a repro on StackBlitz. You need to run npm run build in terminal there. See the problem is that tsc inlines a lot of hotscript code in the .d.ts file making it unreadable mess.

image

What's extremely odd is that it does that for one function, getPath, but not the other, setPath, even though both use the same set of utility types. Do you have any idea how to get rid of this? Thanks!

@ecyrbe
Copy link
Collaborator

ecyrbe commented Mar 16, 2023

It's indeed really weird.
Since you are exporting the type it should use the exported type.
Can you try to use tsup to generate the build and check if the output is better ?

@dkzlv
Copy link
Author

dkzlv commented Mar 17, 2023

@ecyrbe The output did change a bit, but somehow to the worse: now it also includes direct imports from hotscript's dist/internals folder, but the problem didn't go anywhere.

image

I updated the project to have build:tsup command.

@ecyrbe
Copy link
Collaborator

ecyrbe commented Mar 17, 2023

Can you try but making HOTScript a peerdependency ?

@GavinMeierSonos
Copy link

TSUP will include a dep sometimes, even if its only a dev dep but is not marked as a peer dep.

@Erbenos
Copy link

Erbenos commented Aug 16, 2023

Similar use case here - have buildable library within NX workspace which I may want to publish for other consumers, the types are mess as well.

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

4 participants