Unable to use hooks in compiled package #4331
-
Beta Was this translation helpful? Give feedback.
Answered by
rschristian
Apr 1, 2024
Replies: 1 comment 8 replies
-
Your Have you opened up your bundles and actually looked at what's being built? Keeping Preact external as you have should make the built output pretty simple, it should be easy to debug. Microbundle might be an option worth considering in place of Vite, it's from the Preact team and should be well suited to libs like this. Just a thought though. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like it works just fine for me, your built output is fine.
The only obvious thing I'd say is ditch
npm link
as it's... not great. All of the local linking utilities are quite awful and unreliable, to be frank. Use something likeyalc
to test packages locally instead, as this fixes a handful of problems you'll only encounter with local symlinks. The problem is likely that your lib is pulling its copy of Preact through the symlink, rather than using the copy in your app.