How to compat about react package that is connected by github sub-module. #4476
-
I hope you're doing well. I have a question regarding a setup issue with Preact and a React package that I'm working on. Currently, I am using a GitHub submodule to include a React package that is not yet published. The React package is linked to my project using npm link, but I'm encountering a problem where preact cannot be found in the node_modules of this React package. In a normal scenario, adding preact as a dependency directly to the React package would solve this issue. However, since the React package is included as a GitHub submodule, directly modifying the submodule's dependencies is not ideal. Are there any recommended solutions or best practices for managing dependencies in this kind of setup? I would appreciate any guidance or suggestions you might have. Thank you! 🙂
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I'd recommend ditching |
Beta Was this translation helpful? Give feedback.
I'd recommend ditching
npm link
for something likeyalc
as it's much closer to real-world usage and fixes some of the major problemsnpm link
has, especially around dependencies. The problem is thatnpm link
, as you've discovered, resolves dependencies against the linked module (soreact-widgets
, in this case). This isn't how modules work in any other scenario, it's a flawed by design utility.