繁体   English   中英

如何在开发服务器中为 react-scripts 启动调用定义基本 URL

[英]how to define base URL in the dev server for react-scripts start call

我有一个主要的 php 服务器。 我必须运行 reactjs 开发服务器,该服务器从yarn start在 php 站点内的目录/reactive中创建(使用 nginx proxy_pass)。

但是我不能将节点服务器的根设置为/reactive 它将它设置为/ ,因此仅加载 html 文件并尝试从/static/js/bundle.js加载捆绑包,这将失败。 如果它是/reactive/static/js/bundle.js它会起作用的。 如何实现这个配置?

"react": "16.8.1"
"react-scripts": "2.1.5"

npm start脚本和 PUBLIC_URL 变量中

"homepage": "/yow-path",
"scripts":{
   "start": "PUBLIC_URL=/reactive node start.js"
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM