-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
What is the best approach for publishing pure TypeScript libaries? #12398
Comments
related discussion can be found in to #12358. Typically you would ship a library with a .js file(s) and a matching .d.ts file(s). You should be able to ship a source-only library, where your users would need to "include" the sources. some of the issues you would have to address are:
|
The issue is that there's no JS to ship until they use it really. They're TypeScript classes in various modules, not a single module and should only be compiled when referenced. Ideally I think they'd be using JSPM or WebPack, yeah. Or tsc actually. So long as their sources can path to mine I guess? |
I do not think we have recommendation for this scenario specifically. potentially, your users can add a pre-build step that copies the sources from your files locally before passing them to tsc or webpack. |
Would it be enough that they can be accessed from the |
I do not think i have any recommendations to share. i had a few possible issues raised in #12398 (comment). You might want to make sure that your workflow addresses these issues . |
I'm working on a library that depends on React, Redux and a handful of other usual suspects.
The thing about this library is that it's really not intended to be consumed by ES. It's just a handful of base classes and conventions that will be used by other TS projects.
This means it has no entrypoint. Almost like a class library in C#, etc...
What I'm basically aiming for is that the inclusion of this package will cause all the downstream dependencies to be pulled in - which I believe npm/yarn will take care of. Then I want the consuming project to reference my
.ts
and.tsx
files, and then when it builds, that's when the files actually get compiled into what will invariably be entrypoints.In my mind, the biggest challenge is just ensuring that somehow the modules can be referenced by other TS code. But as always, there could be more to this than what I'm immediately aware of ;)
The text was updated successfully, but these errors were encountered: