from old refine.dev project with webpack to new with the same data with vite

Hello everybody! If I want to upgrade my project from an older version from webpack to vite, will everything work faster and can there be problems with this and what is the best thing to do in that case. Also will I just need to create a new project with vite and move the files from the old folder to the new one?
6 Replies
kapa.ai
kapa.ai12mo ago
Hi @RomaY. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Migrating your project from webpack to Vite can potentially make your development process faster due to Vite's features like native ES modules support, fast build process, and hot module replacement. However, the migration process needs to be done carefully to avoid any issues. Here are the steps you need to follow according to the source (https://refine.dev/blog/what-is-vite-vs-webpack): 1. Install Vite and all its plugins. You can check the getting started guide here (https://vitejs.dev/guide/). 2. Make sure your project is using ES modules. You can do that by going to your package.json file and pasting "type": "module". 3. Remove all webpack configuration files, like webpack.config.js, and replace it with a vite.config.js file. Also in your scripts, you'll need to update with this:
"build": "vite build",
"dev": "vite serve",
"build": "vite build",
"dev": "vite serve",
4. Make sure to remove webpack loaders and plugins that are no longer in use and test your application, so everything is working as it should. You don't necessarily need to create a new project with Vite and move the files from the old folder to the new one. You can directly migrate your existing project by following the steps above. However, it's always a good idea to backup your project before making such changes. Remember, while Vite offers many advantages, it might not be suitable for all projects. It's important to thoroughly test your application after the migration to ensure everything works as expected. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai12mo ago
<@538717491908575242> kapa.ai is still learning and improving, please let us know how it did by reacting below
metropolitan-bronze
metropolitan-bronze12mo ago
ok, thanks, if there are any questions, I will contact you
metropolitan-bronze
metropolitan-bronze12mo ago
Hey @RomaY, We changed all example CRA to vite without creating a new project. Changes to the existing project are enough! The PR we changed our examples with can give you an idea: https://github.com/refinedev/refine/pull/4663
metropolitan-bronze
metropolitan-bronze12mo ago
@salihozdemir Great, RAM consumption from react has decreased by 5 times, from 2.5 GB to 0.2~0.5 GB
metropolitan-bronze
metropolitan-bronze12mo ago
Great! Happy coding ⚡