[WIP] frontend: Replace CRA with Vite #1696
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What I did
This PR is related to the issue #1282.
Changes apply only to the
/frontend
directory and replaceCRA
withVite 5
for development and production builds.Thanks to Vite cold start is much faster and gives better DX.
Because of failing tests, this PR is still in progress.
Benchmarks:
CRA:
cold start: 1m 30s
build: 1m 50s
Vite:
cold start: 2.5s
build: 48s
Overview:
analysis.html
produced after build via rollup-plugin-visualizer)Detailed migration steps:
react-scripts
%PUBLIC_URL%
REACT_APP_
environment variables toVITE_
vite.config.ts
jest.config.ts
package.json
process.env
withimport.meta.env
and move envs to global constantsrequire
Known issues:
@storybook/addon-storyshots
is deprecated. See migration guide.Proposition of further steps:
Jest
withVitest
webpack
(check relationships and potential impact)