create react app not loading css background images in dev or build

前端 未结 3 1602
执念已碎
执念已碎 2021-02-20 07:39

I\'m having difficulty with some background images not loading. I\'ve made some significant modifications to the initial create react app, my folder structure is now as follows

3条回答
  •  既然无缘
    2021-02-20 08:11

    Add homepage in package.json to run build in any apache server

    {
      "name": "app",
      "version": "0.1.0",
      "private": true,
      "homepage": "http://{servername}/{foldername}/",
    
    }
    

    then create build in react using

    1. npm run build
    2. npm install -g serve
    3. serve -s build
    4. Copy build folder and paste in server like xampp/htdocs and hit url

提交回复
热议问题