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

Migrate from Webpack and Jest to Vite and Vitest #3104

Merged
merged 12 commits into from
Jan 16, 2024
Merged

Conversation

grahamalama
Copy link
Contributor

@grahamalama grahamalama commented Jan 12, 2024

This PR all started when I was investigating mozilla/remote-settings#522

I suspected some rerendering was causing elements to go stale, so I fired up Kinto Admin and went to look at the profiler only to discover that React thought we were running a production build.

image

I went to make the necessary configuration changes to enable a development build, but I quickly became disheartened by the task of modifying Webpack config.

I then though about how Webpack is pretty slow in general, compared to newer tools. I tried out a few different bundlers (esbuild, parcel, Vite), and Vite seemed to be the easiest to use and was faster that Webpack.

I made that change, but then quickly found out that Jest is incompatible with Vite. I searched for answers there as well and found https://vitest.dev/, which is the "part 2" of this PR. Migrating to Vitest also seemed to expose some errors in our tests

Overall after this PR, we have:

  • a faster, more-featured local development experience
  • less config to manage

Some of the changes in this PR required mass find-and-replaces (d84f5f3 and e0d1815), so I'd recommend stepping through by commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was mostly me trying to merge our old tsconfig with what was provided by their template

Copy link
Contributor

@alexcottner alexcottner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes me so happy that can swap out testing frameworks this easily now.

@grahamalama
Copy link
Contributor Author

Note that this PR changes one of the environment variables used when building the bundle --

- SINGLE_SERVER
+ KINTO_ADMIN_SINGLE_SERVER

we'll need to account for this in the build process. ASSET_PATH should stay the same.

@grahamalama grahamalama merged commit 47ed19d into master Jan 16, 2024
6 checks passed
@grahamalama grahamalama deleted the vite-and-vitest branch January 16, 2024 14:54
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