Using `“homepage”` in package.json, without messing up paths for localhost

后端 未结 4 1253
清酒与你
清酒与你 2020-12-02 14:08

This question actually follows directly from my answer on a previous question.

I added a \"homepage\" to my package.json because it is a Re

4条回答
  •  广开言路
    2020-12-02 14:58

    For instance, problem can be because the 'index.html' file pointed to "/static/js/...js" and that will work if we release the application in the root folder, but if you have various static developments in the same machine using the same Apache Server you have a problem.

    Configure Package.json with:

    "homepage": "."
    

    That will make use of relative paths instead of using absolute paths in the current folder. i.e. "./static/js/...js" Most common mistake while doing this change is inserting "./" and not "."

    Further if you are not using react-router i.e. no client routing, you should be safe to go without this hack..

提交回复
热议问题