简体   繁体   中英

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

I have a primary php server. I have to run the reactjs dev server created from yarn start within a directory /reactive within the php site (using nginx proxy_pass).

But I cannot set the root of the node server to be /reactive . It sets it to / and therefore just the html file loads and tries to load bundle from /static/js/bundle.js which will fail. If it were /reactive/static/js/bundle.js it would have worked. How to achieve this configuration?

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

at yow package.json in the npm start script and a PUBLIC_URL variable

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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