根据如何升级使用create-rect应用程序构建的React项目,我已经将React脚本从v1.14更新到v3.4.3。然而,主页上有一个问题我无法妥善解决。
在以前的package.json中,我有"homepage": "/temp_project/resources"
在我将react脚本更新到v3.4.3之后,除了当npm启动("start": "react-scripts start"
(时,路径将变为http://localhost:3000/temp_project/resources这是预料不到的。(预计http://localhost:3000/(热修复=手动将路径更改为http://localhost:3000/每次
如果我将"homepage": "/temp_project/resources"
更改为"homepage": "/"
,则我的http://localhost:8080/temp_project(索引页(变为空白页。我的npm启动("start": "react-scripts start"
(工作良好。
我该怎么办??如果这是个愚蠢的问题,我很抱歉。非常感谢。
补充:
这是一个使用eirslett/frontendmaven插件的mavenspring-boot项目和maven资源插件
软件包.json
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:8080",
"homepage": "/temp_project/resources",
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
你能试试"homepage": "."
还是"homepage": "./"
吗。。。让我知道它是否有助于