gpt4 book ai didi

reactjs - 更改 asset-manifest.json 中的路径

转载 作者:行者123 更新时间:2023-12-03 05:43:59 26 4
gpt4 key购买 nike

我已经获取了这个示例 ReactJS 项目 > https://github.com/alik0211/pokedex尝试 Azure DevOps。当我在本地构建项目并在构建文件夹中使用 npm start 时,应用程序工作正常。这是文件 http://localhost:3000/static/js/0.chunk.js 的路径`.

但是在我的 Azure 环境中 http://pokedeks.azurewebsites.net/服务器正在寻找 http://pokedeks.azurewebsites.net/pokedex/static/js/2.c662eb5c.chunk.js 。请注意,`/pokedex/文件夹已添加到路径中。我不确定为什么会发生这种情况。

我可以通过在构建文件夹中运行 serve 而不是 npm start 来在本地重现它:http://localhost:5000/pokedex/static/js/2.a7ba4e0c.chunk.js

我尝试将 npm start 添加到发布管道中的任务中,但这也会导致错误。所以我认为最快的方法是弄清楚为什么在使用 serve/pokedex/ 文件夹会添加到路由中?

最佳答案

我通过将 package.json 中的 homepage 值替换为 "homepage": "https://alik0211.github.io/解决了这个问题pokedex/","homepage": "./", 现在,当我运行 serve 时,文件的路径是正确的。

关于reactjs - 更改 asset-manifest.json 中的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56410471/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com