[英]react-scripts build generates wrong path for sub folder
My application should be served at /sub-folder
so in the package.json
the homepage
field is set to我的应用程序应该在
/sub-folder
中提供,因此在package.json
中, homepage
字段设置为
"homepage": "/sub-folder/",
The production bundle generated by react-scripts build
is placed inside the dist
directory that looks like react-scripts build
生成的生产包放置在dist
目录中,看起来像
/dist
/static
/js
main.[hash].js
...
asset-manifest.json
index.html
...
However index.html
is trying to load at the following path但是
index.html
正在尝试在以下路径加载
<script defer="defer" src="/sub-folder/static/js/main.41ee4874.js">
and obviously fails and won't load anything.显然失败了,不会加载任何东西。
What is wrong with my configuration?我的配置有什么问题?
I hope you are looking for it.我希望你正在寻找它。
/ package.json
"scripts": {
"build": "BUILD_PATH='./sub-folder' react-scripts build",
// ...
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.