Because all unnecessary files are deleted when the project is initialized, only the files shown in the figure are left (node_modules is not moved, only two files are left under public: index.html and favicon.ico, and only one file is left under src: index. js).
Execution: yarn ejectThe following problems will occur.
cengguilideMacBook-Pro:myapp zengguili$ yarn eject
yarn run v1.22.19
$ react-scripts eject
NOTE: Create React App 2+ supports TypeScript, Sass,CSS Modules and more without ejecting: https://reactjs.org/blog/2018/10/01/create-react-app-v2.html
✔ Are you sure you want to eject? This action is permanent. … yes
This git repository has untracked files or uncommitted changes:README.md
Dpublic/logo192.png
Dpublic/logo512.png
Dpublic/manifest.json
Dpublic/robots.txt
D src/App.css
D src/App.js
D src/App.test.js
D src/index.css
M src/index.js
D src/logo.svg
D src/reportWebVitals.js
D src/setupTests.js
Remove untracked files, stash or commit any changes, and try again.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
solution
Enter the terminal command:
git add -A
git commit -m'init'
Select y to execute.
Execute the command again: yarn ejectthe webpack rules can be exposed.