How to bundle a React app to a subdirectory on a server?

前端 未结 10 2122
名媛妹妹
名媛妹妹 2020-12-04 14:41

I have a React app I\'ve been developing on my localhost. I want to copy it to a server into a subdirectory called vensa.

My webpack config file looks like this..

10条回答
  •  粉色の甜心
    2020-12-04 15:24

    Adding to trenthogan's reply, we can assign basename to location.pathname

    const loc = window.location || {};
    
      
    
    

    With this change, the app will work even if the subdirectory path changes in the future.

提交回复
热议问题