Skip to content

Commit

Permalink
Revert "Support all combinations of vite, rails & vite + rails combo …
Browse files Browse the repository at this point in the history
…for dev env"

This reverts commit ec81d60.
  • Loading branch information
vishwasraj-thyagaraj committed Sep 26, 2024
1 parent ec81d60 commit 0aba655
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion vite_ruby/lib/vite_ruby/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ def config_defaults(asset_host: nil, mode: ENV.fetch('RACK_ENV', 'development'),
'config_path' => option_from_env('config_path') || DEFAULT_CONFIG.fetch('config_path'),
'mode' => option_from_env('mode') || mode,
'root' => option_from_env('root') || Dir.pwd + '/frontend-react',
'public_output_dir' => 'vite',
}.select { |_, value| value }
end

Expand Down
6 changes: 1 addition & 5 deletions vite_ruby/lib/vite_ruby/dev_server_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ def file_in_vite_root?(path)
#
# If the path starts with that prefix, it will be redirected to Vite.
def vite_url_prefix
# These are the following public_output_dir values that will be considered for each env combo
# When vite server alone is running the public_output_dir should be ""
# When rails server alone is running the public_output_dir should be "vite", which is hardcoded in the config
# When both vite and rails server are running the /#{ config.public_output_dir }/ should be "" as rails tries to serve the assets from the vite server
@vite_url_prefix ||= config.public_output_dir.empty? ? VITE_DEPENDENCY_PREFIX : ""
@vite_url_prefix ||= config.public_output_dir.empty? ? VITE_DEPENDENCY_PREFIX : "/#{ config.public_output_dir }/"
end
end

0 comments on commit 0aba655

Please sign in to comment.