fullstack-typescript icon indicating copy to clipboard operation
fullstack-typescript copied to clipboard

Requirement for shared files to contain third party dependencies

Open priyath opened this issue 3 years ago • 5 comments

Curious to know if the following scenario is handled by the project where some shared files may require third party dependencies specified in its own package.json file.

Specifically, how can we include these dependencies in the build output?

priyath avatar Apr 14 '21 13:04 priyath

Can you give a more detailed example?

gilamran avatar Apr 14 '21 14:04 gilamran

Thanks for the response. Okay so it looks like you maintain a single package.json file to handle dependencies from all three packages? I guess in that case, the above issue is not really a problem.

I am currently trying out an approach where each package (client/server/shared) have their own package.json file to manage dependencies. It works well, however if the shared code has an external dependency X (defined in its own package.json file), the final build (for either the client or server), fails to run as it cannot find X. That is essentially the problem.

Would be interesting to know your thoughts on that!

priyath avatar Apr 14 '21 17:04 priyath

Why would you want to split the package.json? the tsconfig.json is the section "borders". You can define types: [] in each tsconfig.json according to your needs.

gilamran avatar Apr 14 '21 18:04 gilamran

In my case, it seems a lot more cleaner to individually maintain dependencies for the client, api, and shared directories, rather than having it globally and constantly updating types for each project whenever things change.

priyath avatar Apr 18 '21 05:04 priyath

You will have to update the types with or without splitting to several package.json If you insist, you should probably try a mono repo. approach with lerna

gilamran avatar Apr 18 '21 07:04 gilamran