reactjs - Change path in asset-manifest.json
问题描述
I've grabbed this example ReactJS project > https://github.com/alik0211/pokedex to experiment with Azure devops. When I build the project locally and use npm start
in the build folder the app works fine. This is the path for a file http://localhost:3000/static/js/0.chunk.js`.
But on my Azure environment http://pokedeks.azurewebsites.net/ the server is looking for http://pokedeks.azurewebsites.net/pokedex/static/js/2.c662eb5c.chunk.js. Notice that the `/pokedex/ folder has been added to the path. I'm unsure why this is happening.
I can reproduce it locally by running serve
in the build folder instead of npm start
: http://localhost:5000/pokedex/static/js/2.a7ba4e0c.chunk.js
I've tried adding npm start
to my tasks in the release pipeline but that's also causing errors. So I think the fastest way is to figure out why when using serve
the /pokedex/
folder gets added to the routes?
解决方案
当我运行文件的路径正确时,我通过替换homepage
我package.json
从现在"homepage": "https://alik0211.github.io/pokedex/",
到现在的值解决了这个问题。"homepage": "./",
serve
推荐阅读
- java - Eclipse程序无法连接MySQL数据库
- python - Python 正则表达式匹配电子邮件
- javascript - previoussibling 和 previouselementsibling-javascript 的区别
- xml - Blogger 中的面包屑导航不正确
- android - RecyclerView 上的 SetY() 对内部项目的工作很奇怪
- excel - 请求解释一行VBA代码
- java - android - 向 Firestore 文档添加自定义 ID
- python - python中的多个赋值
- javascript - 使用 intlTelInput 验证带有国家代码的电话号码
- ruby-on-rails - Rails 6 入门:如何启动一个空白的新 Rails 6 应用程序