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

Blogpost Siren - Using Fable to create libraries for multiple languages #194

Open
Freymaurer opened this issue Jun 4, 2024 · 4 comments

Comments

@Freymaurer
Copy link
Contributor

Hey, so i spent some time on a hobby project, in which i used Fable to create a library i published for python, js (+types), f# and c#.

In addition i wrote a blogpost about it on the issues i encountered, possible solutions and more.

If you are interested have a look here.

@ncave
Copy link
Collaborator

ncave commented Jun 4, 2024

@Freymaurer Nice blogpost!

A small note, the default behavior of not attaching members to the class for JS/TS is done not just to allow member overloads, but mainly to allow the members to be tree-shaken by bundlers (if not used), and thus minimize bundle size.

Also, since interface implementation members are attached by default, implementing an interface would be another way to keep the members from being mangled and detached (although this doesn't work for static interface members yet, unless they have a default implementation).

@Freymaurer
Copy link
Contributor Author

That makes sense! Is there a way to allow tree shaking with attached members?

Thanks for the input!

@ncave
Copy link
Collaborator

ncave commented Jun 4, 2024

@Freymaurer

Is there a way to allow tree shaking with attached members?

It was not possible in the past, that's why the default detached member behavior in Fable is like that.
(e.g. from an old rollup article, "It doesn’t currently remove things like unused methods from objects that are used").

But things might have changed, you may have to check your bundler's documentation.

@MangelMaxime
Copy link
Member

@Freymaurer

Really interesting blog post, and can serve as a basis if others want to explore use Fable and generating code to consume from Native languages.

Great job 👍

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

3 participants