Skip to content

Reimplement copy-webpack-plugin for vite

What does this MR do and why?

We have a few dependencies for which we copy static assets to public/assets/webpack: WebIDE, Source Graph and the PDF viewer.

In webpack we use the copy-webpack-plugin for this. It basically takes an array of files/directories and copies them to public/assets/webpack.

In this commit we move the definition for this to webpack.constants.js and import it to vite.config.js. Given our config for the copy-webpack-plugin is rather limited (only absolute paths, no globs), we can re-implement a rather smallish scope of the plugin for vite.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Before After
Screenshot_2024-03-19_at_23.45.46 Screenshot_2024-03-19_at_23.46.35

How to set up and validate locally

  1. Ensure vite and webpack are both not running, in fact the whole GDK can be off.
  2. In GitLab folder rm -rf public/assets/webpack
  3. Run yarn run webpack, this might take a while
  4. Add the statically copied paths: git add -f public/assets/webpack/gitlab-vscode public/assets/webpack/pdfjs public/assets/webpack/sourcegraph public/assets/webpack/visual_review_toolbar.js
  5. Run rm -rf public/assets/webpack again
  6. Start vite gdk start vite
  7. There should be no diff on public/assets/webpack

Start the rest of the GDK gdk start:

  1. Open the Web IDE.
  2. Happiness
Edited by Lukas 'ai-pi' Eipert

Merge request reports