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

Replace create react app with vite #164

Merged

Conversation

ZauberNerd
Copy link
Contributor

@ZauberNerd ZauberNerd commented Jul 7, 2023

This PR builds upon #163 and thus includes the changes from that PR as well. If #163 gets merged, the diff in this PR will be smaller.
For reviewing purposes, you could check out the "Commits" tab and review the commits separately.


create-react-app seems to struggle a bit reactjs/react.dev#5487 (comment) and many folks are
recommending vite as an alternative, as that project is more active.
For me the reason to switch to vite is to reduce dependencies and speed
up the build process.

Replacing create-react-app with vite reduce the number of dependencies
from 1762 to 444.

I was also quite surprised, by how small the actual diff in this commit
is. From that perspective there is almost no discernible difference
between the two tools.


Not sure, if you are up for any major changes, I just forked this repository and started tinkering a bit - feel free to close it if it doesn't fit in your vision.

⚠️ Please note that I didn't test this extensively, so further testing to verify that all features still work as expected is required. ⚠️

@ZauberNerd ZauberNerd changed the title Replace create react app vite Replace create react app with vite Jul 7, 2023
@ZauberNerd ZauberNerd force-pushed the replace-create-react-app-vite branch from aa24126 to cdc57b4 Compare July 7, 2023 12:05
@cogentapps
Copy link
Owner

Thanks for working on this!

I’ll need some time to review and test it out, but from a quick skim it looks good, and I agree with the reasoning for switching away from CRA.

create-react-app seems to struggle a bit [1] and many folks are
recommending vite as an alternative, as that project is more active.
For me the reason to switch to vite is to reduce dependencies and speed
up the build process.

Replacing create-react-app with vite reduce the number of dependencies
from 1762 to 444.

I was also quite surprised, by how small the actual diff in this commit
is. From that perspective there is almost no discernible difference
between the two tools.

[1]: reactjs/react.dev#5487 (comment)
@ZauberNerd ZauberNerd force-pushed the replace-create-react-app-vite branch from cdc57b4 to a3da33d Compare July 7, 2023 20:13
Vite does not natively ship a Buffer polyfill and most of the
functionality that is required here, can be implemented natively (except
for the byte-wise compare, for that I had to write my own function).
For some reason the vite-plugin-comlink doesn't seem to work in this
constellation.
I tried to reproduce in a new vite project and there it did work.
But also, the plugin does some horrible magic by replacing a
non-existant constructor `ComLinkWorker()` with the `wrap()` method
and then the only real benefit is, that we wouldn't need to write the
`expose()` method in the worker. So for that reason I'm removing the
plugin and using the comlink package directly.
@ZauberNerd ZauberNerd force-pushed the replace-create-react-app-vite branch from 387a266 to 0701303 Compare July 8, 2023 13:43
@cogentapps
Copy link
Owner

Looks good, merging. Thanks again, this is great work!

@cogentapps cogentapps merged commit d7e493c into cogentapps:main Jul 9, 2023
@ZauberNerd ZauberNerd deleted the replace-create-react-app-vite branch July 9, 2023 19:42
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