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

refactor: implement vite and remove live-server #162

Closed
wants to merge 1 commit into from

Conversation

AhmedElbohoty
Copy link
Contributor

@AhmedElbohoty AhmedElbohoty commented Aug 21, 2024

This pull request implements Vite as the development server.
I use vite to serve the demo file, replacing the live-server package due to its high-severity npm issues.
This change prepares the project for future enhancements and builds using Vite.

  • What kind of change does this PR introduce?
    Change Type: Configuration Update

  • What is the new behavior?
    No new behavior is implemented.

  • Implementation Details:
    Add Vite configuration files.
    Update scripts in package.json to use Vite for serving the demo.
    Remove live-server package from dependencies.

With live-server:
Screenshot 2024-08-21 at 10 35 01 AM
Screenshot 2024-08-21 at 10 35 17 AM

With vite:
Screenshot 2024-08-21 at 10 52 43 AM

Copy link

netlify bot commented Aug 21, 2024

Deploy Preview for racingbars ready!

Name Link
🔨 Latest commit a6e9c6c
🔍 Latest deploy log https://app.netlify.com/sites/racingbars/deploys/66c59cf0f993e00008d96c5e
😎 Deploy Preview https://deploy-preview-162--racingbars.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@hatemhosny
Copy link
Owner

Nice suggestion.

Vite is definitely much more than a dev server, and I think it is a great option when starting any new web app.

However, I'm actually happy with the current build system which uses esbuild both for development and production builds (with differences only in minification and source maps).

I'm also using some ?hacks like building some files then importing them as strings, injecting styles, loading web worker as data URL, patching TypeScript definitions, ...etc I'm not sure vite will cover all these scenarios.

If it ain't broken, don't fix it :)

Maybe I should later on document the workflow and the justifications for those decisions in some contribution guides.

Long ago, this project used a library that used rollup under the hood for build. It was so much slower and error-prone. Esbuild is really really fast and I do not need to deal with inconsistencies between development and production builds.

I'm using the dev server only for demo purposes for some plain html files that cover different scenarios. The docs website uses docusaurus which has its own dev server. Maybe we still need to change live-server to a better package. However, I haven't had major problems with it.

I may even replace all these demo files with live playgrounds, since now we have LiveCodes. And then maybe we even get rid of the dev server all together!

Anyway, I will still try out your proposed changes and let you know about my thoughts. I'm out for the next 3 days. I will get back to you once I get a chance.

I'm really grateful for your contributions.
Thank you 💚

@AhmedElbohoty
Copy link
Contributor Author

AhmedElbohoty commented Aug 21, 2024

I'm grateful for your explanation 😄

Absolutely, I understand if your current setup with esbuild is working well and you're happy with it, there's no rush to change things up. It sounds like you’ve crafted a robust workflow with your customizations and optimizations.

Documenting your setup and decisions could be valuable for future contributors or for clarity within the project.

I'll go ahead and experiment with the vite on a separate branch to gain more experience and see how they fit with current setup.

I will close this pull request.

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