is there another way to group dependencies by which to include for the deployment?

Viewed 20

I have a cross-platform app which will be also deployed into web, using Next.js and Capacitor.

Two platforms(Web/App) are sharing some assets and codes and it will be more in the future, so I ended up deciding to keep this system. But the problem is sometimes I need to organize them by its purposes.

I know there's two way to group dependencies by prod and dev, but it wouldn't work for my case. I want to split them like dependencies for the web, app, and maybe shared(global) one to speed up build process for each deployment.

Or I would say I just want to omit app-specific dependencies like @capacitor/... while deploying web part.

Do you have any idea for this? Or should I just pick up another strategy for this case?

Appreciate your thoughts in advance!

1 Answers

Unless your build tool is terrible, packages that are installed but not used will not be part of the build (it might take a few seconds to install them, but then that's it), so you can keep everything in one file (assuming you are using npm, that would be package.json).

Otherwise you can manage dependencies separately per project, but then you will have the maintenance challenge of making sure the dependencies are updated in each project at the same time.

Related