lib/vite_rails/runner.rb in vite_rails-1.0.8 vs lib/vite_rails/runner.rb in vite_rails-1.0.9

- old
+ new

@@ -29,13 +29,12 @@ # Internal: Executes the command with the specified arguments. def execute_command(args) cmd = vite_executable cmd.prepend('node', '--inspect-brk') if args.include?('--debug') cmd.prepend('node', '--trace-deprecation') if args.delete('--trace-deprecation') - args.append('--mode', ENV['RAILS_ENV']) unless args.include?('--mode') || args.include?('-m') + args.append('--mode', ViteRails.mode) unless args.include?('--mode') || args.include?('-m') cmd += args - puts cmd.join(' ') Dir.chdir(File.expand_path('.', Dir.pwd)) { Kernel.exec(ViteRails.env, *cmd) } end # Internal: Resolves to an executable for Vite. def vite_executable @@ -47,10 +46,8 @@ File.exist?(path) end # Internal: Returns a path where a Vite executable should be found. def vite_bin_path - ENV["#{ ViteRails::ENV_PREFIX }_VITE_BIN_PATH"] || `yarn bin vite`.chomp - rescue StandardError - "#{ `npm bin`.chomp }/vite" + ENV["#{ ViteRails::ENV_PREFIX }_VITE_BIN_PATH"] || `yarn bin vite`.chomp.presence || "#{ `npm bin`.chomp }/vite" end end