title: npm build how to change package.json - homepage value by variable or script
body: <p>I created my app using <code>create-react-app</code>, and I use <code>npm run build</code> to build the production package.</p>
  <p>I need to put the app on different clients' sites, each client put the app on a different sub-folder.</p>
  <p>e.g.<br />
  client A: <code>https://clientA.com/myApp</code><br />
  client B: <code>https://clientB.com/UAT/myApp</code><br />
  client C: <code>https://clientC.com/webApps/myApp</code></p>
  <p>everytime when I build the package, for different sub-folders, I need to modify the <code>homepage</code> value in <code>package.json</code>, build the package and repeat this steps mulltiple times.</p>
  <p>My manual steps like:</p>
  <ol>
  <li>modify <code>&quot;homepage&quot;: &quot;myApp&quot;</code> &gt; <code>npm run build</code> &gt; save the build folder for deployment</li>
  <li>modify <code>&quot;homepage&quot;: &quot;/UAT/myApp&quot;</code> &gt; <code>npm run build</code> &gt; save the build folder for deployment</li>
  <li>modify <code>&quot;homepage&quot;: &quot;/webApps/myApp&quot;</code> &gt; <code>npm run build</code> &gt; save the build folder for deployment</li>
  <li>keep repeatly doing the above.....</li>
  </ol>
  <p>how can I improve this situation? how can I do build once to fit all different paths?<br />
  such as, can I use a variable in <code>homepage</code> value and set it up in environment variable?</p>
  <p>or, can I write a script to do some? I hope to simpify this compile steps, ideally to execute the build or a building script once.</p>
  <p>Thanks for any help or suggestion.</p>