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

Drop Create-React-App #766

Merged
merged 10 commits into from
Jan 8, 2025
Merged

Drop Create-React-App #766

merged 10 commits into from
Jan 8, 2025

Conversation

sergei-maertens
Copy link
Member

Partly closes #724

Good bye and thanks for all the fish.

dist-vite is now dist, obsoleting the CRA build artifacts.
The 'scripts' directory is being removed with the removal of CRA.
start.js and build.js were the react-scripts entrypoints for CRA. They
have been obsoleted by switching to Vite in the package.json scripts.
Utility/development scripts are now properly colocated in the bin/
folder, for consistency across projects/repositories.
Everything is replaced with Vite configuration.
These have been replaced with their VITE_* counterparts or are entirely
obsoleted now.
Copy link

codecov bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.42%. Comparing base (212263a) to head (e8d8763).
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #766      +/-   ##
==========================================
+ Coverage   81.10%   81.42%   +0.31%     
==========================================
  Files         235      235              
  Lines        4859     4851       -8     
  Branches     1324     1322       -2     
==========================================
+ Hits         3941     3950       +9     
+ Misses        888      870      -18     
- Partials       30       31       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

And some other stuff that appears to not be used anymore.
@sergei-maertens sergei-maertens marked this pull request as ready for review January 6, 2025 16:49
@robinmolen
Copy link
Contributor

vite.config.mts has a type import from 'rollup', but this isn't defined as a dependency in the project.. Is rollup missing from the package.json, or am i missing something? :)

@robinmolen
Copy link
Contributor

Another question about the vite.config.mts:

Im seeing a TS error about the test config. I took a 'quick' look and came across this stack overflow discussion (yes, its a bit older..) https://stackoverflow.com/questions/72146352/vitest-defineconfig-test-does-not-exist-in-type-userconfigexport.

One of the suggestions was about misaligned vite/vitest versions, so i took a look at that.. The vitest version that we use, "^2.1.8", is dependent on vite "^5.0.0". So i've changes the vite version locally to "^5.0.0", which solves the issue..

Is there a reason why we use version "^6.0.5" for vite?

Another solution might would be to define the type ourselfs, or to move the test config to a separate file?

@sergei-maertens
Copy link
Member Author

vite.config.mts has a type import from 'rollup', but this isn't defined as a dependency in the project.. Is rollup missing from the package.json, or am i missing something? :)

Vite depends on rollup, so it's a transitive dependency :) The production build is made using rollup, in dev mode Vite uses native browser modules.

@sergei-maertens
Copy link
Member Author

Another question about the vite.config.mts:

Im seeing a TS error about the test config. I took a 'quick' look and came across this stack overflow discussion (yes, its a bit older..) https://stackoverflow.com/questions/72146352/vitest-defineconfig-test-does-not-exist-in-type-userconfigexport.

Yes - it's a known issue - it's because Vitest officially only supports Vite 5 and support for Vite 6 is currently in beta (or RC) - I'm waiting for Vitest 3 to be stable and then we can upgrade and it should resolve the type error! There's a github issue in vitest for it. There are some dirty workarounds, but ultimately it's something that we just have to wait for.

Is there a reason why we use version "^6.0.5" for vite?

It released just after doing the initial configuration and everything appears to work properly with Vite 6, and I don't want to "start" a new toolchain already on an outdated major version.

IMO we can just ignore the type error for the time being because it doesn't break anything except cause some red lines in your editor, but my expectation and hope is that we won't have to touch this config file for a while now.

@robinmolen
Copy link
Contributor

Yes - it's a known issue - it's because Vitest officially only supports Vite 5 and support for Vite 6 is currently in beta (or RC) - I'm waiting for Vitest 3 to be stable and then we can upgrade and it should resolve the type error! There's a github issue in vitest for it. There are some dirty workarounds, but ultimately it's something that we just have to wait for.

Ah okay, yeah then waiting for that release sounds like a fine solution. Changing to a different Vite version will then indeed only create more work...

IMO we can just ignore the type error for the time being because it doesn't break anything except cause some red lines in your editor, but my expectation and hope is that we won't have to touch this config file for a while now.

Yeah fair enough, it still works fine.. Hopefully a stable Vitest 3 will be released soon, so we can fix the typing issue :)

Copy link
Contributor

@robinmolen robinmolen left a comment

Choose a reason for hiding this comment

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

I really like the red numbers 😄

I think everything looks good. The typescript warning does kinda bother me, but hopefully we can fix that soon with a Vitest update

@sergei-maertens sergei-maertens merged commit 729c807 into main Jan 8, 2025
16 of 20 checks passed
@sergei-maertens sergei-maertens deleted the cleanup/724-drop-cra branch January 8, 2025 09:31
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.

Update toolchain (Jest/Vitest/ViteJS/TS)
2 participants