Skip to content

Commit

Permalink
fix: enforce vite 5 manifest location (#432)
Browse files Browse the repository at this point in the history
This should have shipped along `3.5.0`, when we started enforcing:

```json
  "vite": "~>5.0.0"
```

That means `3.5.0` would fail early if used with vite 4, prompting users to run `bin/vite upgrade`, which would install vite 5.

Any deployment that switches from vite 4 to vite 5 would modify `package.json`, so the [last build would be stale](https://github.com/ElMassimo/vite_ruby/blob/main/vite_ruby/lib/vite_ruby/builder.rb#L16), making it safe to assume the manifests will always be in the new location.

---------

Co-authored-by: Maximo Mussini <[email protected]>
  • Loading branch information
KieranP and ElMassimo authored Oct 11, 2024
1 parent e1c52e5 commit ce2df58
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions vite_ruby/lib/vite_ruby/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ def host_with_port
def known_manifest_paths
[
# NOTE: Generated by Vite when `manifest: true`, which vite-plugin-ruby enables.
'manifest.json',
build_output_dir.join('.vite/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
]
}
build_output_dir.join('.vite/manifest-assets.json'),
]
end

# Internal: Path to the manifest files generated by Vite and vite-plugin-ruby.
Expand Down

0 comments on commit ce2df58

Please sign in to comment.