Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent error when using a proc in asset_host (close #202) #203

Merged
merged 2 commits into from
Apr 14, 2022

Conversation

ElMassimo
Copy link
Owner

@ElMassimo ElMassimo commented Apr 14, 2022

Description 📖

This pull request fixes #202 by ignoring asset_host in Rails when configured with a Proc.

Background 📜

Usually, the asset host will be used as the base for Vite, which is a good default, especially when asset_host is configured to target a CDN.

Rails allows to use a Proc to dynamically configure asset_host, allowing to return different values depending on the source, the URL of an asset.

Since there's no "right" value to pass to Vite when asset_host is a Proc, it's better to ignore it, which in most cases would still allow assets to be correctly resolved.

In the few cases where this is not desired, assetHost can be explicitly configured in config/vite.json, config/vite.rb, or via environment variables.

@ElMassimo ElMassimo merged commit cb23a81 into main Apr 14, 2022
@ElMassimo ElMassimo deleted the fix/asset-host-proc branch April 14, 2022 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support asset_host as a Proc
1 participant