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
Is your feature request related to a problem? Please describe.
I have a RoR app running on https://example.com/my-app
When I compile the assets for production, URLs used in my CSS are incorrect: expected /my-app/vite/assets/foo.png, got /vite/assets/foo.png. this issue is normal since my vite configuration is incomplete.
According to the vite documentation, the public base path is the solution. Let's tweak the configuration:
We're getting close to what I would expect. However, the two leading slashes annoy me. After some research in your code the slashes are added in config.ts:103
Describe the solution you'd like
Be able to change the base property
Or
remove the 2 leading slashes. Developers still have the choice to add them manually if they want to.
{"all": {"sourceCodeDir": "app/assets","watchAdditionalPaths": [],"assetHost": "/my-app",// or "assetHost": "//my-app",,// or"assetHost": "https://example.com/my-app"}}
The text was updated successfully, but these errors were encountered:
Hosting a Rails app in a nested path is unusual, but I think it makes sense to add a separate base setting in config/vite.json to support this use case.
It would also make sense to allow configuring this setting using environment variables, like for other settings (VITE_RUBY_BASE=my_app). All it takes to implement that, is adding a default value for base:
Is your feature request related to a problem? Please describe.
I have a RoR app running on https://example.com/my-app
When I compile the assets for production, URLs used in my CSS are incorrect: expected
/my-app/vite/assets/foo.png
, got/vite/assets/foo.png
. this issue is normal since my vite configuration is incomplete.According to the vite documentation, the public base path is the solution. Let's tweak the configuration:
It looks like
RubyPlugin()
overwrites my custom configuration. Let's find another way.I read through the vite-ruby doc and found the assetHost property:
We're getting close to what I would expect. However, the two leading slashes annoy me. After some research in your code the slashes are added in config.ts:103
Describe the solution you'd like
base
propertyOr
The text was updated successfully, but these errors were encountered: