Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
313 views
in Technique[技术] by (71.8m points)

ReactJS app keeps getting deployed to Heroku with Development build instead of Production

I have a problem with Heroku deployment. I want to deploy the production build of my application, however the development version somehow keeps getting deployed, as you can see in this screenshot:

React developer tool

This is my package.json

{
  "name": "portfolio",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "bootstrap": "^4.5.3",
    "react": "^17.0.1",
    "react-bootstrap": "^1.4.0",
    "react-dom": "^17.0.1",
    "react-player": "^2.7.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.0",
    "web-vitals": "^0.2.4"
  },
  "scripts": {
    "start": "GENERATE_SOURCEMAP=false react-scripts start", 
    "build": "GENERATE_SOURCEMAP=false react-scripts build ",
    "test": "GENERATE_SOURCEMAP=false react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

This is my bitbucket-pipeline.yml content:

    image: node:10.16.0
pipelines:
 default:
   - step:
      script: #default script to run
          - npm install
 branches:
   master:
     - step:
         name: Joseph production Deployment to Heroku
         deployment: production
         caches:
            - node
         script: #deploy master branch to heroku master
            - npm install 
            - git push *(my git details here)*

If I run npm run build and serve a static version of the website using serve -s build, a production version works locally, how can I do that on the heroku server?

question from:https://stackoverflow.com/questions/65641999/reactjs-app-keeps-getting-deployed-to-heroku-with-development-build-instead-of-p

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...