티스토리 뷰
React 개발 환경 준비 (설치)
npx (빠른 시작)
npx create-react-app my-app
npm
npm init react-app my-app
Yarn
yarn create react-app my-app
아래처럼 화면이 나오면 설치 완료
Created git commit.
Success! Created my-app at ~/my-app
Inside that directory, you can run several commands:
yarn start
Starts the development server.
yarn build
Bundles the app into static files for production.
yarn test
Starts the test runner.
yarn eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd my-app
yarn start
Happy hacking!
React 배포(build)용 컴파일
1) build 만들기
npm run build
> react-app@0.1.0 build
> react-scripts build
Creating an optimized production build...
Compiled successfully.
File sizes after gzip:
43.71 kB build\static\js\main.42744c20.js
1.78 kB build\static\js\787.b701888c.chunk.js
541 B build\static\css\main.073c9b0a.css
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
npm install -g serve
serve -s build
Find out more about deployment here:
https://cra.link/deployment
2) 웹 서버 만들기
npx serve -s build
참고자료
댓글