From 0aba6558143de046914ec06c162afd20c371711a Mon Sep 17 00:00:00 2001 From: Vishwasraj Date: Thu, 26 Sep 2024 18:15:45 +0530 Subject: [PATCH] Revert "Support all combinations of vite, rails & vite + rails combo for dev env" This reverts commit ec81d6026f66859c8abaf89e881be8594f267023. --- vite_ruby/lib/vite_ruby/config.rb | 1 - vite_ruby/lib/vite_ruby/dev_server_proxy.rb | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/vite_ruby/lib/vite_ruby/config.rb b/vite_ruby/lib/vite_ruby/config.rb index e7fa11b4..c37f7bf7 100644 --- a/vite_ruby/lib/vite_ruby/config.rb +++ b/vite_ruby/lib/vite_ruby/config.rb @@ -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 diff --git a/vite_ruby/lib/vite_ruby/dev_server_proxy.rb b/vite_ruby/lib/vite_ruby/dev_server_proxy.rb index 00e1fedc..2970b087 100644 --- a/vite_ruby/lib/vite_ruby/dev_server_proxy.rb +++ b/vite_ruby/lib/vite_ruby/dev_server_proxy.rb @@ -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