Skip to content

Conversation

@frandiox
Copy link
Contributor

NPM >= 7 installs peerDependencies by default except if they are marked as optional (according to this). Since we don't need certain dependencies in the init command and they are already included in the templates, we can stop installing them at the beginning when npm create @shopify/hydrogen is called, and install them in the background later together with all the other app deps.

@remix-run/dev alone is ~119MB so this should hopefully speed up installation times.

The best way to test this will be when it's merged by using npm create @shopify/hydrogen@next. However, you can also test locally by renaming node_modules/@remix-run/dev to a different name and running h2 init (or other commands to see the error).

Copy link

@wizardlyhel wizardlyhel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@frandiox frandiox merged commit 291115d into main Sep 6, 2023
@frandiox frandiox deleted the fd-reduce-cli-install-size branch September 6, 2023 13:40
juanpprieto pushed a commit that referenced this pull request Sep 17, 2025
* Remove dependency of init command on remix-run/dev

* Make peerDeps optional, including remix-run/dev

* Show a proper error when remix-run/dev is not installed

* Changesets

* Remove more deps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants