stackblitz/alien-signals

Tree-shakeable

Closed this issue · 0 comments

Hi, the library is not tree-shaking well, all the imports from unstable are leaking into the final bundle, without being used. I suspect this is because they're being exported as an object, maybe?

Here's a Stackblitz demo. As you can see in dist/index.js, despite only pulling in signal, computed and effect, entire unstable lib is getting included.

This line is the culprit:

export * as unstable from './unstable/index.js';

A solution I tested that worked is prefixing all the exports with unstable_ prefix. You'd have to replace the . character with _ in your own implementations though, that's the only catch. Here is the PR I made to show the change. Feel free to close if you feel it's not the right direction. #28

Would appreciate if the library could be tree-shakeable 😄

Thanks!