资源文件路径问题

  如果你使用create-react-app创建项目,执行命令 yarn build 后,直接以静态方式打开build文件夹内的index.html,会看到页面显示出现问题,打开console后会看到js、css、svg等文件的路径出现问题。

react 执行 yarn build 页面无法显示
项目结构:(build文件夹)
react 执行 yarn build 页面无法显示

解决方案:

  打包之前在package.json中,添加了 "homepage": "."

react 执行 yarn build 页面无法显示

相关文章:

  • 2021-06-23
  • 2022-12-23
  • 2021-06-21
  • 2021-06-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-16
  • 2022-12-23
  • 2022-01-22
  • 2021-09-04
  • 2021-06-04
  • 2021-11-11
相关资源
相似解决方案