Reactjs index.html仅显示从create react应用程序生成的部分组件
以前,在运行Reactjs index.html仅显示从create react应用程序生成的部分组件,reactjs,create-react-app,Reactjs,Create React App,以前,在运行warn build后打开index.html显示一个空白页面 我通过在我的package.json中添加“homepage”:“/”,设法让它显示一些东西 现在它确实显示了一些东西,但是缺少了很多组件。主要是它不呈现src/data/images中的任何图像 除此之外,浏览器还显示以下错误: Access to internal resource at 'file:///Users/josephliu/workspace/speedlimit_signs/build/manifes
warn build
后打开index.html显示一个空白页面
我通过在我的package.json中添加“homepage”:“/”
,设法让它显示一些东西
现在它确实显示了一些东西,但是缺少了很多组件。主要是它不呈现src/data/images中的任何图像
除此之外,浏览器还显示以下错误:
Access to internal resource at 'file:///Users/josephliu/workspace/speedlimit_signs/build/manifest.json' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, brave, chrome-untrusted, https.
以下是我的项目文件夹的外观:
project/
build/
public/
src/
components/
data/
train_images/
test_images/
结果是(这就是我使用的)一个文件://路径。因此,我改为使用HashRouter,它解决了问题请分享您的代码,可能会出现一些问题,如不调用所需组件、提供错误目录或丢失路由等。当然,这里是github链接:我刚刚添加了一个更新。关于manifest.json有一个CORS错误