Skip to content

Add Vite support to the GDK

Lukas 'ai-pi' Eipert requested to merge leipert-add-vite-support into main

What does this merge request do and why?

This adds support for vite to the gdk. vite is an alternative to webpack and with: gitlab!135714 (merged) we gain support to use it in development and testing (feature specs).

See also: gitlab-org/frontend/rfcs#106

Closes: #1991 (closed)

How to set up and validate locally

Setup

  1. If you already run vite locally, make sure it is stopped.
  2. Do a gdk update
  3. Run git checkout leipert-add-vite-support in the gdk folder.
  4. Inside gitlab/ folder: Run git merge-base --is-ancestor 0e35808bc7c HEAD && echo 'vite supported' || echo 'oh NOES' to double-check that your GitLab contains gitlab!135714 (merged)
  5. Run gdk start to ensure your gdk is running
  6. Run echo "Feature.enable(:vite)" | gdk rails c to enable the vite feature flag. This is needed for some older branches.
  7. Run gdk stop webpack rails-web to stop the rails app / webpack
  8. Run gdk config set webpack.enabled false to disable webpack
  9. Run gdk config set vite.enabled true to enable vite
  10. Run gdk reconfigure to update the config files
  11. Run gdk restart vite rails-web to restart the rails app and vite as the developer server.

Verification

  1. Visiting pages in the GDK should work
  2. You should be able to run any feature spec, e.g. bin/rspec spec/features/commit_spec.rb

GDK specific things

In order to minimize confusion, vite and webpack cannot be enabled at the same time. So the following should print a nice error:

gdk config set webpack.enabled true
gdk config set vite.enabled true
gdk reconfigure # => Error
# ERROR: Running vite and webpack at the same time is unsupported.
# Consider running `gdk config set webpack.enabled false` to disable webpack.

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • Announcement added, if change is notable.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.
Edited by Lukas 'ai-pi' Eipert

Merge request reports