Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Vite4 or Vite5 manifests, not both #432

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

KieranP
Copy link
Contributor

@KieranP KieranP commented Jan 23, 2024

Description 📖

This fixes an issue where upgrading to Vite5 was merging old Vite4 and Vite5 manifests together, creating JS errors.

Background 📜

This was happening because vite_ruby was merging vite4 and vite5 manifests together.

The Fix 🔨

Check for Vite5 manifests. If present, use those, otherwise fall back to Vite4 manifests.

Amends #420

@rgioia
Copy link

rgioia commented Feb 7, 2024

I'm going through the same problem.

@emptyflask
Copy link

I just upgraded to Vite 5 and am dealing with this now as well.

]

vite5_manifest_paths = manifest_files.map do |path|
build_output_dir.join(".vite/#{path}")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
build_output_dir.join(".vite/#{path}")
build_output_dir.join(".vite/#{ path }")

Looks like this repo's RuboCop config wants us to do this. (RuboCop docs)

Screenshot 2024-03-25 at 15 08 59

vite_ruby/.rubocop.yml

Lines 72 to 73 in 369facf

Layout/SpaceInsideStringInterpolation:
EnforcedStyle: space

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 @KieranP, any chance we can get this PR fixed up and rebased? Would be nice to have it ready so it can be merged so it's in the next release, whenever that is. 🙏 🙇‍♂️

Don't want to keep production application on cherry-picked fix branch long term. 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@larouxn Done and done

This fixes an issue where upgrading to Vite5 was merging old Vite4 and Vite5 manifests together, creating JS errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants