Skip to content

Instantly share code, notes, and snippets.

@AviFS
Created April 18, 2025 21:14
Show Gist options
  • Save AviFS/d0262010abbb75781595b304892afe28 to your computer and use it in GitHub Desktop.
Save AviFS/d0262010abbb75781595b304892afe28 to your computer and use it in GitHub Desktop.
Attempt to patch ViteRuby::COMPANION_LIBRARIES hash from within vite_roda main file
require "vite_ruby"
require_relative "vite_roda/version"
require_relative "vite_roda/tag_helpers"
# ViteRuby::COMPANION_LIBRARIES is a hash containing the companion
# libraries for Vite Ruby, and their target framework, defined at:
# https://github.com/ElMassimo/vite_ruby/blob/95c247a66d86f15ad9ce783acf92fef96646091b/vite_ruby/lib/vite_ruby.rb#L23
# It's required to autoload the cli extensions (e.g. the one at vite_roda/installation.rb)
# in ViteRuby::CLI::require_framework_libraries at:
# https://github.com/ElMassimo/vite_ruby/blob/95c247a66d86f15ad9ce783acf92fef96646091b/vite_ruby/lib/vite_ruby/cli.rb#L20
# And it is called in the bin/vite executable installed by Vite Ruby at line 10:
# https://github.com/ElMassimo/vite_ruby/blob/95c247a66d86f15ad9ce783acf92fef96646091b/vite_ruby/exe/vite#L10
# I believe this needs to match the name of the gem
ViteRuby::COMPANION_LIBRARIES['vite_roda'] = 'roda'
module ViteRoda
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment