posthog-js icon indicating copy to clipboard operation
posthog-js copied to clipboard

Preact as a dependency and not peer dependency

Open michealroberts opened this issue 1 year ago • 3 comments

I'm wondering if it was intentional to ship Preact with the base posthog-js package as a dependency rather than as a peerDependency or as an optionalDependency?

Referencing this line here:

https://github.com/PostHog/posthog-js/blob/ac7525eab9632d352d0a8d1a0532abcca70d1a5d/package.json#L42

May I suggest we have the core package, maybe under:

@posthog/core

Which doesn't bundle with preact, and the 😀

@posthog/surveys etc for anything where a decision has been made to include UI elements?

michealroberts avatar Sep 23 '24 19:09 michealroberts

I'm also concerned about this - especially because preact seems to be pretty heavy (Unpacked Size 1.42 MB, according to https://www.npmjs.com/package/preact )

lukaselmer avatar Oct 05 '24 17:10 lukaselmer

@lukaselmer I did see this:

https://github.com/PostHog/posthog-js-lite

michealroberts avatar Oct 05 '24 18:10 michealroberts

Thanks @michealroberts!

lukaselmer avatar Oct 05 '24 21:10 lukaselmer