问题
I am new to React and learning how to properly create new project. Then I came across --scripts-version
when we create new project with such command:
create-react-app new-project --scripts-version
Why do we need to use --scripts-version
?
回答1:
The tool create-react-app is basically a wrapper around a number of tools and configuration options stored in an npm package called react-scripts.
When you use the create-react-app
command to create your React app, it uses react-scripts
to set up your project.
The command line option --scripts-version
is an advanced feature to change which version of react-scripts
is used.
If you are not happy with the way create-react-app
sets up your project, you can fork the react-scripts
repository, change it and then use your version to create your React apps.
来源:https://stackoverflow.com/questions/57364042/why-we-need-the-scripts-version-command-line-option-for-create-react-app