-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Option] Disable automatic dependency installation #7568
Comments
This would be a useful addition to CRA. In Storybooks, they support this option via the command line flag Here is the flag documented, which defaults to Here is where they check and install deps based on this flag: Looking at react-scripts, the line for installing deps is here: I'd suggest wrapping that block in an additional check for Here are the options where we'll need to add a
Its not super clear to me how the options get passed to init, but I think its here: create-react-app/packages/create-react-app/createReactApp.js Lines 337 to 346 in 5036825
Lastly, I'm concerned there might be multiple places where dependencies are added, rather than just all at once at end of script, so we'd want to make sure we hit all of these places in our check, and that it didn't break functionality. Need to know which dependencies are installed to make "script" work versus. for the finished react-app. |
Looking further here is the chain of functions from commander to init
|
I looked into this issue, and tried to implement the code discussed above for a PR. It seems like it would be very difficult to get working without a larger refactor. Adding a conditional check to the code at https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/scripts/init.js#L324-L331, only prevents the dependencies taken from whatever template is being used, which by default seems to be a very small portion of the packages installed. You might also need to add some sort of conditional check here https://github.com/facebook/create-react-app/blob/master/packages/create-react-app/createReactApp.js#L407. However, it seems like you need the installed packages here for the rest of the creation of a react app. The code looks like it adds and installs packages along the way as it creates the new react app. In order to have an easy flag to stop installing dependencies, you may have to refactor it to not install along the way and instead install them all at the end, like other packages such as Docusaurus do. However, this seems like it would be difficult or impossible with this repository so this does not seem feasible to me. |
nearly two years later, is there any update ? |
Is your proposal related to a problem?
No
Describe the solution you'd like
It would be nice to be able to use create-react-app to create a new project without automatically installing all of the dependencies. Something like
create-react-app app-name --skipInstall
similar to how the @angular/cli works.Describe alternatives you've considered
It doesn't appear that there are any options for configuring create-react-app other than additional logging. Manually creating a React project from scratch would be counterproductive.
Additional context
I find myself generating a lot of template/placeholder projects with create-react-app, without the need to run them right away. It would greatly speed up the process if I could optionally omit the dependency installation step.
The text was updated successfully, but these errors were encountered: