You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that if you pass values that don't strictly conform to the "valid values" for the base config option, during production builds a forward slash / is added both before and after said value.
For example, if I set base to {{.Base}} the index.html will include /{{.Base}}/ before all assets.
Coming over from CRA I previously would just set my %PUBLIC_URL% to whatever value I desired and this would be output accordingly, though it seems I cannot do that with Vite without an additional step to strip said slashes.
Is this behaviour expected and strictly necessary?
In my explicit use case, we add the above value so that our Go backend application can use templating to achieve a dynamic path for our frontend React application.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
It seems that if you pass values that don't strictly conform to the "valid values" for the base config option, during production builds a forward slash
/
is added both before and after said value.For example, if I set
base
to{{.Base}}
theindex.html
will include/{{.Base}}/
before all assets.Coming over from CRA I previously would just set my
%PUBLIC_URL%
to whatever value I desired and this would be output accordingly, though it seems I cannot do that with Vite without an additional step to strip said slashes.Is this behaviour expected and strictly necessary?
In my explicit use case, we add the above value so that our Go backend application can use templating to achieve a dynamic path for our frontend React application.
Beta Was this translation helpful? Give feedback.
All reactions