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

Vite #1882

Merged
merged 26 commits into from
Oct 24, 2022
Merged

Vite #1882

merged 26 commits into from
Oct 24, 2022

Conversation

jrochkind
Copy link
Contributor

@jrochkind jrochkind commented Oct 13, 2022

This PR will leave CSS and static file assets (like images) in sprockets for now.

Also we will leave blacklight JS in sprockets for now, even though theoretically blacklight-frontend would allow us to shift it over, there are just some complexities we're going to handle separately. Including what it's dependencies do to our node_modules tree (projectblacklight/blacklight#2849), and the desire to move CSS over to vite too, so we can have Blacklight CSS and JS both from the same blacklight_frontend version.

This will, hopefully, leave us in a place no worse than our previous webpacker situation (no more confusing or hard to maintain), so can be merged and deployed, and even keep living like this for a while.

    bundle exec vite install

But we changed things over to generic app/frontend, not app/javascripts that the install script wanted to use seeing we already had webpacker. We want to keep them separate.

Also we have not committed the Procfile.dev for now, I don't think we'll use foreman.
@jrochkind
Copy link
Contributor Author

Vite-rails has some special instructions for deploying with heroku... but they don't appear to me to be necessary right now. And based on what they do, it definitely seems better to avoid them if not necessary.

https://vite-ruby.netlify.app/guide/deployment.html#using-heroku

@jrochkind
Copy link
Contributor Author

I was having some mysterious problems that went away with rm -rf node_modules ; yarn install -- it's possible you'll have to do that in development.

@jrochkind
Copy link
Contributor Author

While we will leave this in draft mode while we do more vite work, this initial step is ready for a review, @eddierubeiz! And would be convenient to get one before i start doing more vite work.

Note: * While things should work without it, you may choose to run the vite dev server in development. Just run: bundle exec vite dev in it's own terminal window. If you are working on modifying JS, this may give you quicker iterative builds and better error messages.

Base automatically changed from update_dependencies to master October 17, 2022 21:28
jrochkind and others added 12 commits October 18, 2022 16:03
In our heroku deployment, our Rails app is directly serving assets (then cached by cloudfront).  Under sprockets/webpacker, .gz alternates were created on asset build. And Rails will then automatically use these to serve content-encoded gzip content to clients which advertise accepting that.

We lost that in initial vite migration, resulting in performance loss in deployed apps, as clients were not getting compressed .js and .css. This should fix that.

ElMassimo/vite_ruby#281
Remove browser JS polyfills no longer required for current supported browsers
Make vite create .gz (and brotli) alternatives for built assets
Don't move it over to vite. We weren't using it. if we ever want to use it, we'll have to figure out how to add it back in via vite
With weird workaround to prevent Blacklight sprockets-included JS from triggering strict mode, which breaks current version of blacklight_range_limit JS
Move as much JS as possible from sprockets to vite
@jrochkind jrochkind marked this pull request as ready for review October 24, 2022 15:58
@jrochkind jrochkind merged commit 7c87628 into master Oct 24, 2022
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.

2 participants