打包react项目

版权声明:本博客内容归个人所有,如需转载,请标明出处。 https://blog.csdn.net/m0_37468171/article/details/89229146

打包react项目

 jim@MacBookPro ⮀ ~/Desktop/my-app ⮀ npm run build

> [email protected] 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! │
│ │
└───────────────────────────────────────────────────┘

猜你喜欢

转载自blog.csdn.net/m0_37468171/article/details/89229146
今日推荐