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 |
---|---|
How to set up and validate locally
- Ensure
vite
andwebpack
are both not running, in fact the whole GDK can be off. - In GitLab folder
rm -rf public/assets/webpack
- Run
yarn run webpack
, this might take a while - 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
- Run
rm -rf public/assets/webpack
again - Start vite
gdk start vite
- There should be no diff on
public/assets/webpack
Start the rest of the GDK gdk start
:
- Open the Web IDE.
- Happiness
Edited by Lukas 'ai-pi' Eipert