lib/vite_ruby/config.rb in vite_ruby-3.3.4 vs lib/vite_ruby/config.rb in vite_ruby-3.4.0

- old
+ new

@@ -15,22 +15,27 @@ def host_with_port "#{ host }:#{ port }" end - # Internal: Path where Vite outputs the manifest file. - def manifest_path - build_output_dir.join('manifest.json') + # Internal: Path to the manifest files generated by Vite and vite-plugin-ruby. + def known_manifest_paths + [ + # NOTE: Generated by Vite when `manifest: true`, which vite-plugin-ruby enables. + 'manifest.json', + # NOTE: Path where vite-plugin-ruby outputs the assets manifest file. + 'manifest-assets.json', + ].flat_map { |path| + [ + build_output_dir.join(".vite/#{ path }"), # Vite 5 onwards + build_output_dir.join(path), # Vite 4 and below + ] + } end - # Internal: Path where vite-plugin-ruby outputs the assets manifest file. - def assets_manifest_path - build_output_dir.join('manifest-assets.json') - end - # Internal: Path to the manifest files generated by Vite and vite-plugin-ruby. def manifest_paths - [manifest_path, assets_manifest_path].select(&:exist?) + known_manifest_paths.select(&:exist?) end # Public: The directory where Vite will store the built assets. def build_output_dir root.join(public_dir, public_output_dir)