打包react项目
jim@MacBookPro ⮀ ~/Desktop/my-app ⮀ npm run build
> my-app@0.1.0 build /Users/jim/Desktop/my-app
> react-scripts build
Creating an optimized production build...
File sizes after gzip:
112.67 KB build/static/js/main.5136087b.js
314 B build/static/css/main.a86ad0ab.css
The project was built assuming it is hosted at the server root.
To override this, specify the homepage in your package.json.
For example, add this to build it for GitHub Pages:
"homepage" : "http://myname.github.io/myapp",
The build folder is ready to be deployed.
You may serve it with a static server:
npm install -g serve
serve -s build
运行之后
jim@MacBookPro ⮀ ~/Desktop/my-app ⮀ serve -s build
┌───────────────────────────────────────────────────┐
│ │
│ Serving! │
│ │
│ - Local: http://localhost:5000 │
│ - On Your Network: http://192.168.1.101:5000 │
│ │
│ Copied local address to clipboard! │
│ │
└───────────────────────────────────────────────────┘