<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sahil Kumar</title>
    <description>The latest articles on DEV Community by Sahil Kumar (@sahi11k).</description>
    <link>https://dev.to/sahi11k</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2946081%2F866c323b-8d12-4125-9233-4a0e30227fba.png</url>
      <title>DEV Community: Sahil Kumar</title>
      <link>https://dev.to/sahi11k</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sahi11k"/>
    <language>en</language>
    <item>
      <title>Supercharging React Development with Vite</title>
      <dc:creator>Sahil Kumar</dc:creator>
      <pubDate>Mon, 31 Mar 2025 17:19:53 +0000</pubDate>
      <link>https://dev.to/sahi11k/transforming-little-engine-into-epic-engine-create-react-app-to-vite-migration-23be</link>
      <guid>https://dev.to/sahi11k/transforming-little-engine-into-epic-engine-create-react-app-to-vite-migration-23be</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;If you've worked with React, you've likely encountered Create React App (CRA)—a command-line tool designed to simplify the process of bootstrapping new React projects. CRA provided a zero-config setup by bundling essential tools like Webpack, Babel, and ESLint, allowing developers to start coding immediately without dealing with complex configurations.&lt;/p&gt;

&lt;p&gt;However, as modern development practices evolve, CRA’s capabilities have become increasingly limited. According to the official React documentation:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Although Create React App makes it easy to get started, there are several limitations that make it difficult to build high-performance production apps. In principle, we could solve these problems by essentially evolving it into a framework."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why Migrate from CRA?
&lt;/h2&gt;

&lt;p&gt;At &lt;a href="https://playsimple.in/" rel="noopener noreferrer"&gt;Playsimple&lt;/a&gt;, our internal dashboard tool relied on CRA until now, but as our application scaled, we began facing several issues that significantly affected our development speed and efficiency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Some challenges faced using CRA:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  🐌 Slow Build Times
&lt;/h4&gt;

&lt;p&gt;CRA relies on Webpack, which pre-processes and bundles all dependencies upfront. As the project grew, this led to increasingly long build times, slowing down iteration speed.&lt;/p&gt;

&lt;h4&gt;
  
  
  ⏳ Long Startup Times
&lt;/h4&gt;

&lt;p&gt;The development server took several seconds to boot up, causing frustration and delays when making quick changes.&lt;/p&gt;

&lt;h4&gt;
  
  
  🏗️ Bloated Configurations
&lt;/h4&gt;

&lt;p&gt;While CRA abstracted Webpack configurations, it also bundled unnecessary dependencies that we rarely touched but still had to maintain.&lt;/p&gt;

&lt;h4&gt;
  
  
  🔄 Slow Hot Module Replacement (HMR)
&lt;/h4&gt;

&lt;p&gt;HMR in CRA was inefficient, causing delays in previewing changes. In contrast, modern tools provide instant feedback, making the development experience much smoother.&lt;/p&gt;

&lt;h4&gt;
  
  
  ⚠️ CRA’s Deprecation
&lt;/h4&gt;

&lt;p&gt;With CRA officially deprecated in February 2025 and its last update in 2022, maintaining compatibility with modern React libraries became increasingly difficult. Sticking with CRA would have meant more workarounds and technical debt in the long run.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Considering these issues, we had to decide: Should we migrate to a framework or switch to a different build tool?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Framework or Build Tool?
&lt;/h2&gt;

&lt;p&gt;Most apps would benefit from a framework, but there are valid cases to build a React app from scratch. A good rule of thumb is if your app needs routing, you would probably benefit from a framework.&lt;/p&gt;

&lt;p&gt;Since our app was already well-structured with React, adding a full-fledged framework would have introduced unnecessary complexity. Instead, we focused on improving developer experience and build performance, leading us to &lt;strong&gt;Vite&lt;/strong&gt;—a faster and more efficient alternative to Webpack-based setups like CRA.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgw5yzfq16lgcrz9wigvn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgw5yzfq16lgcrz9wigvn.jpg" alt="Webpack vs Vite Downloads in the past 5 years" width="800" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Webpack vs Vite Downloads in the past 5 years&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Vite⚡
&lt;/h2&gt;

&lt;p&gt;Vite (French word for "quick", pronounced &lt;em&gt;/vit/&lt;/em&gt;, like "veet") is a build tool that aims to provide a faster and leaner development experience for modern web projects. It consists of two major parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A dev server&lt;/strong&gt; that provides rich feature enhancements over native ES modules, for example, extremely fast Hot Module Replacement (HMR).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A build command&lt;/strong&gt; that bundles your code with Rollup, pre-configured to output highly optimized static assets for production.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  How Vite is Different
&lt;/h3&gt;

&lt;p&gt;Unlike Webpack, which bundles everything upfront, Vite leverages native ES modules (ESM) and only processes the files needed on demand. This results in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;⚡ &lt;strong&gt;Instant Startup&lt;/strong&gt; – No waiting for the entire app to compile. Vite serves files directly to the browser, enabling instant cold starts.&lt;/li&gt;
&lt;li&gt;🔥 &lt;strong&gt;Faster HMR&lt;/strong&gt; – Changes reflect instantly in the browser without a full-page reload, making development smoother.&lt;/li&gt;
&lt;li&gt;📦 &lt;strong&gt;Smaller &amp;amp; Optimized Builds&lt;/strong&gt; – Vite uses esbuild for pre-bundling, which is 10-100x faster than Webpack.&lt;/li&gt;
&lt;li&gt;🛠️ &lt;strong&gt;Simplified Configuration&lt;/strong&gt; – Unlike CRA, which requires ejecting for custom setups, Vite offers a simple &lt;code&gt;vite.config.js&lt;/code&gt; file for flexibility.&lt;/li&gt;
&lt;li&gt;📉 &lt;strong&gt;Less Boilerplate &amp;amp; Dependencies&lt;/strong&gt; – CRA comes with outdated dependencies. Vite is leaner, faster, and more efficient.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F24s8n69ljagqppd9gk33.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F24s8n69ljagqppd9gk33.jpg" alt="Comparison of traditional bundle-based dev servers vs Vite’s dev server" width="800" height="218"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Comparison of traditional bundle-based dev servers vs Vite’s dev server&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚠️Caveats
&lt;/h2&gt;

&lt;p&gt;While Vite offers significant advantages, there are some caveats to consider:&lt;/p&gt;

&lt;h3&gt;
  
  
  Vite Doesn’t Use ESM for Production
&lt;/h3&gt;

&lt;p&gt;Although native ESM is widely supported, using unbundled ESM in production remains inefficient due to extra network round trips—even with HTTP/2. For optimal performance, bundling with tree-shaking, lazy-loading, and chunk splitting is still necessary.&lt;/p&gt;

&lt;h3&gt;
  
  
  Vite Uses Rollup Instead of esbuild for Production
&lt;/h3&gt;

&lt;p&gt;Vite's current plugin API isn't compatible with esbuild as a production bundler. While esbuild is faster, Rollup provides a better balance between performance and flexibility. However, ongoing efforts, such as the Rust-based &lt;strong&gt;Rolldown&lt;/strong&gt; project, may further improve Vite’s build performance in the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Migrating from CRA to Vite drastically improved our development workflow, reducing build times, enhancing responsiveness, and simplifying configuration.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Build time dropped from 5 minutes to just 60 seconds.&lt;/strong&gt;&lt;br&gt;
✅ &lt;strong&gt;Development server startup reduced from 30 seconds to under 1 second.&lt;/strong&gt;&lt;br&gt;
✅ &lt;strong&gt;Hot reloading is now nearly instantaneous, thanks to Vite’s optimized approach.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This transition has empowered our team to iterate faster, reduce friction in development, and maintain a scalable build system.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://vitejs.dev/" rel="noopener noreferrer"&gt;Vite Official Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://react.dev/blog/2025/sunsetting-create-react-app" rel="noopener noreferrer"&gt;React Blog: Sunsetting Create React App&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔜 Next Steps: &lt;a href="https://dev.to/sahillk/migrating-from-create-react-app-to-vite-a-step-by-step-guide-1b4k"&gt;Read the Migration Guide →&lt;/a&gt;
&lt;/h3&gt;

</description>
      <category>react</category>
      <category>cra</category>
      <category>webpack</category>
      <category>vite</category>
    </item>
    <item>
      <title>Migrating from Create React App to Vite — A Step-by-Step Guide</title>
      <dc:creator>Sahil Kumar</dc:creator>
      <pubDate>Mon, 31 Mar 2025 16:56:13 +0000</pubDate>
      <link>https://dev.to/sahi11k/migrating-from-create-react-app-to-vite-a-step-by-step-guide-1b4k</link>
      <guid>https://dev.to/sahi11k/migrating-from-create-react-app-to-vite-a-step-by-step-guide-1b4k</guid>
      <description>&lt;p&gt;Migrating from Create React App (CRA) to Vite enhances development speed and efficiency, making it ideal for industry-level projects. CRA’s reliance on Webpack often results in slower builds and hot module replacement (HMR). Vite, leveraging ES modules, provides instant HMR, faster builds, and a leaner setup. This guide walks through the migration process, covering essential updates for configurations, environment variables, TypeScript, testing, and build optimizations.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Install Required Packages
&lt;/h3&gt;

&lt;p&gt;First, install the necessary dependencies for Vite:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;vite @vitejs/plugin-react &lt;span class="nt"&gt;--save-dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;vite&lt;/code&gt;&lt;/strong&gt; is the core build tool and development server that provides fast bundling and HMR.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;@vitejs/plugin-react&lt;/code&gt;&lt;/strong&gt; enables React-specific optimizations like Fast Refresh and JSX transformation.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  2. Create Vite Configuration File
&lt;/h3&gt;

&lt;p&gt;Create a &lt;strong&gt;&lt;code&gt;vite.config.ts&lt;/code&gt;&lt;/strong&gt; file in the root directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;react&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@vitejs/plugin-react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;react&lt;/span&gt;&lt;span class="p"&gt;()],&lt;/span&gt;
  &lt;span class="na"&gt;server&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;open&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;server.port&lt;/code&gt;&lt;/strong&gt; specifies the port on which the Vite development server will run. By default, Vite uses port &lt;strong&gt;&lt;code&gt;5173&lt;/code&gt;&lt;/strong&gt;, by setting it to &lt;strong&gt;&lt;code&gt;3000&lt;/code&gt;&lt;/strong&gt; makes it consistent with CRA.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;server.open&lt;/code&gt;&lt;/strong&gt; automatically opens the browser when the development server starts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Move &lt;code&gt;index.html&lt;/code&gt; to Root
&lt;/h3&gt;

&lt;p&gt;Move &lt;strong&gt;&lt;code&gt;public/index.html&lt;/code&gt;&lt;/strong&gt; to the project root and update &lt;strong&gt;&lt;code&gt;src&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"./src/index.jsx"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unlike Webpack, which dynamically injects the &lt;strong&gt;&lt;code&gt;src&lt;/code&gt;&lt;/strong&gt; attribute into &lt;strong&gt;&lt;code&gt;index.html&lt;/code&gt;&lt;/strong&gt; using plugins like &lt;strong&gt;&lt;code&gt;HtmlWebpackPlugin&lt;/code&gt;&lt;/strong&gt;, Vite requires you to explicitly define the entry file. Since Vite does not modify &lt;strong&gt;&lt;code&gt;index.html&lt;/code&gt;&lt;/strong&gt; dynamically, specifying the &lt;strong&gt;&lt;code&gt;src&lt;/code&gt;&lt;/strong&gt; ensures the application loads correctly.&lt;/p&gt;

&lt;p&gt;Now, remove all &lt;strong&gt;&lt;code&gt;%PUBLIC_URL%&lt;/code&gt;&lt;/strong&gt; occurrences in the index.html file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- CRA --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"icon"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"%PUBLIC_URL%/favicon.ico"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- VITE --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"icon"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/favicon.ico"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  4. Update Script Commands
&lt;/h3&gt;

&lt;p&gt;Replace the CRA scripts in &lt;strong&gt;&lt;code&gt;package.json&lt;/code&gt;&lt;/strong&gt; with Vite equivalents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vite"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vite build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  5. Update Environment Variables
&lt;/h3&gt;

&lt;p&gt;Vite exposes env variables under &lt;strong&gt;&lt;code&gt;import.meta.env&lt;/code&gt;&lt;/strong&gt; object as strings automatically. To prevent accidentally leaking env variables to the client, only variables prefixed with &lt;strong&gt;&lt;code&gt;VITE_&lt;/code&gt;&lt;/strong&gt; are exposed to your Vite-processed code.&lt;/p&gt;

&lt;h5&gt;
  
  
  Update Variable Declarations:
&lt;/h5&gt;

&lt;p&gt;Replace &lt;strong&gt;&lt;code&gt;REACT_APP_&lt;/code&gt;&lt;/strong&gt; with &lt;strong&gt;&lt;code&gt;VITE_&lt;/code&gt;&lt;/strong&gt; in all your environment variables&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// CRA&lt;/span&gt;
&lt;span class="nx"&gt;REACT_APP_STAGING&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;staging&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// VITE&lt;/span&gt;
&lt;span class="nx"&gt;VITE_STAGING&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;staging&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Update Variable Usage:
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// CRA&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;REACT_APP_STAGING&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;staging&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dev&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// VITE&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;VITE_STAGING&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;staging&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dev&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  6. Improve TypeScript Support and &lt;code&gt;tsconfig.json&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;If your project uses TypeScript, follow these steps to ensure compatibility and improved performance.&lt;/p&gt;

&lt;p&gt;Update the following properties in &lt;code&gt;tsconfig.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"moduleResolution"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"bundler"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"isolatedModules"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"types"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"vite/client"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"include"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"vite.config.ts"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One thing you should know about Vite is that Vite only performs transpilation on &lt;strong&gt;&lt;code&gt;.ts&lt;/code&gt;&lt;/strong&gt; files and does &lt;strong&gt;NOT&lt;/strong&gt; perform type checking. It assumes type checking is taken care of by your IDE and build process.&lt;/p&gt;

&lt;p&gt;The reason Vite does not perform type checking as part of the transform process is because the two jobs work fundamentally differently. Transpilation can work on a per-file basis and aligns perfectly with Vite's on-demand compile model. In comparison, type checking requires knowledge of the entire module graph. Shoe-horning type checking into Vite's transform pipeline will inevitably compromise Vite's speed benefits.&lt;/p&gt;

&lt;h5&gt;
  
  
  Adding type checking support in Development
&lt;/h5&gt;

&lt;p&gt;During development, if you need more than IDE hints, Vite recommends running &lt;strong&gt;&lt;code&gt;tsc --noEmit --watch&lt;/code&gt;&lt;/strong&gt; in a separate process, or use &lt;strong&gt;&lt;code&gt;vite-plugin-checker&lt;/code&gt;&lt;/strong&gt; if you prefer having type errors directly reported in the browser. In this guide we will go with the second approach.&lt;/p&gt;

&lt;p&gt;Install &lt;strong&gt;&lt;code&gt;vite-plugin-checker&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; vite-plugin-checker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;vite.config.ts&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;tsChecker&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vite-plugin-checker&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;tsChecker&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;typescript&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;})],&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Adding type checking support for Production Builds
&lt;/h5&gt;

&lt;p&gt;For production builds, we will run &lt;strong&gt;&lt;code&gt;tsc --noEmit&lt;/code&gt;&lt;/strong&gt; in addition to Vite's build command.&lt;br&gt;
Update &lt;strong&gt;&lt;code&gt;package.json&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"tsc --noEmit &amp;amp;&amp;amp; vite build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;The &lt;strong&gt;&lt;code&gt;--noEmit&lt;/code&gt;&lt;/strong&gt; flag prevents the compiler from generating JavaScript output files.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  7. Convert Files to &lt;code&gt;.jsx&lt;/code&gt; and &lt;code&gt;.tsx&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Rename files accordingly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.js&lt;/code&gt;&lt;/strong&gt; → &lt;strong&gt;&lt;code&gt;.jsx&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;.ts&lt;/code&gt;&lt;/strong&gt; → &lt;strong&gt;&lt;code&gt;.tsx&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why is this required ?&lt;br&gt;
    Vite avoids processing all &lt;strong&gt;&lt;code&gt;.js&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;.ts&lt;/code&gt;&lt;/strong&gt; files for JSX or TypeScript syntax by default to prevent unnecessary overhead, which could slow down the development server and build times. Instead, by explicitly using &lt;strong&gt;&lt;code&gt;.jsx&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;.tsx&lt;/code&gt;&lt;/strong&gt; extensions, Vite selectively applies transformations only to the files that require them. When encountering these files, Vite leverages esbuild to efficiently transform JSX or TypeScript syntax into standard JavaScript, ensuring faster builds and a more optimized development workflow.&lt;/p&gt;




&lt;h3&gt;
  
  
  8. Add Absolute Path Support &amp;amp; Path Aliasing
&lt;/h3&gt;

&lt;p&gt;In the Vite configuration file, paths can be resolved using the config.resolve property. Since manually defining numerous paths can be tedious, we use the vite-tsconfig-paths package. This package enables Vite to resolve imports using TypeScript’s path mapping automatically.&lt;/p&gt;

&lt;p&gt;Install &lt;strong&gt;&lt;code&gt;vite-tsconfig-paths&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; vite-tsconfig-paths
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;vite.config.ts&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;tsconfigPaths&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vite-tsconfig-paths&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;tsconfigPaths&lt;/span&gt;&lt;span class="p"&gt;()],&lt;/span&gt;
  &lt;span class="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@assets&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;src/assets&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If any of your path aliases do not work as expected with &lt;strong&gt;&lt;code&gt;vite-tsconfig-paths&lt;/code&gt;&lt;/strong&gt;, you can manually define them as shown above.&lt;/p&gt;




&lt;h3&gt;
  
  
  9. Add SVG Support
&lt;/h3&gt;

&lt;p&gt;Install &lt;strong&gt;&lt;code&gt;vite-plugin-svgr&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; vite-plugin-svgr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;vite.config.ts&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;svgr&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vite-plugin-svgr&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;svgr&lt;/span&gt;&lt;span class="p"&gt;()],&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Import SVG files as components:
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ChartIcon&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@assets/icons/Charts.svg?react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  10. Configure Production Build &amp;amp; Target
&lt;/h3&gt;

&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;vite.config.ts&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;outDir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;build&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;es2021&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;build.outDir&lt;/code&gt;&lt;/strong&gt; specifies the output directory for the built files. By default, Vite outputs the build to the dist folder, but here it is customized to match CRA's default output directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;build.target&lt;/code&gt;&lt;/strong&gt; sets the JavaScript target version for the output files. The default value is "modules", ensuring compatibility with modern browsers that support ES module syntax.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For older browser compatibility, refer to the &lt;a href="https://vite.dev/guide/build.html#browser-compatibility" rel="noopener noreferrer"&gt;Vite Browser Compatibility Guide&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  11. Add Testing with Vitest
&lt;/h3&gt;

&lt;p&gt;Install testing dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; vitest jsdom @testing-library/react @testing-library/jest-dom @vitest/ui
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;tsconfig.json&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"types"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"vitest/globals"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;package.json&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"test"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vitest --ui"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;&lt;code&gt;--ui&lt;/code&gt;&lt;/strong&gt; flag in &lt;strong&gt;&lt;code&gt;vitest --ui&lt;/code&gt;&lt;/strong&gt; starts the Vitest UI, providing a visual test runner interface. It allows you to view test results, rerun specific tests, and debug failing tests interactively within a browser-based interface.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;vite.config.ts&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;globals&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;jsdom&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;setupFiles&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="cm"&gt;/* &amp;lt;path to test setup file&amp;gt; */&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;include&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;src/**/*.test.*&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update test setup file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;expect&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vitest&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;matchers&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@testing-library/jest-dom/matchers&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// extends Vitest's expect method with methods from react-testing-library&lt;/span&gt;
&lt;span class="nx"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;matchers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update Test Files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;describe&lt;/code&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;expect&lt;/code&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;it&lt;/code&gt;&lt;/strong&gt;, and &lt;strong&gt;&lt;code&gt;test&lt;/code&gt;&lt;/strong&gt; work the same as in Jest&lt;/li&gt;
&lt;li&gt;Replace &lt;strong&gt;&lt;code&gt;jest.fn()&lt;/code&gt;&lt;/strong&gt; with &lt;strong&gt;&lt;code&gt;vi.fn()&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;For further changes, refer to &lt;a href="https://vitest.dev/guide/migration.html#jest" rel="noopener noreferrer"&gt;Vitest Migration Guide&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  12. Adding Code Coverage
&lt;/h3&gt;

&lt;p&gt;We will integrate &lt;strong&gt;Istanbul&lt;/strong&gt; to generate code coverage reports. Other available option is &lt;strong&gt;&lt;code&gt;v8&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Installation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; @vitest/coverage-istanbul
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update Script in &lt;strong&gt;&lt;code&gt;package.json&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"test:coverage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vitest run --coverage"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;vite.config.ts&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;coverage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;istanbul&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;reporter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;lcov&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="na"&gt;include&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="cm"&gt;/* Specify directory or files here */&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  13. Enable Source Maps &amp;amp; Add Bundle Visualizer
&lt;/h3&gt;

&lt;p&gt;To enable source maps in Vite, update the &lt;strong&gt;&lt;code&gt;build.sourcemap&lt;/code&gt;&lt;/strong&gt; option in the Vite configuration:&lt;/p&gt;

&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;vite.config.ts&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;sourcemap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since Vite uses &lt;strong&gt;Rollup&lt;/strong&gt; for production builds, we will install &lt;strong&gt;&lt;code&gt;rollup-plugin-visualizer&lt;/code&gt;&lt;/strong&gt; to visualize source maps.&lt;/p&gt;

&lt;p&gt;Install &lt;strong&gt;&lt;code&gt;rollup-plugin-visualizer&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; rollup-plugin-visualizer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;vite.config.ts&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;visualizer&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rollup-plugin-visualizer&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;visualizer&lt;/span&gt;&lt;span class="p"&gt;()],&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To prevent the visualizer from running with every build, we will create a separate script for it.&lt;br&gt;
Update &lt;strong&gt;&lt;code&gt;package.json&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"stats"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vite build &amp;amp;&amp;amp; open stats.html"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  14. Setting Global Variable
&lt;/h3&gt;

&lt;p&gt;Vite does not define a global field on &lt;strong&gt;&lt;code&gt;window&lt;/code&gt;&lt;/strong&gt; like Webpack does. Some libraries rely on this behavior because Webpack, being older, has established it as a common practice.&lt;/p&gt;

&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;index.html&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
  &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;global&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;globalThis&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  15. Update storybook support
&lt;/h3&gt;

&lt;p&gt;Install @storybook/react-vite&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt;  @storybook/react-vite
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;.storybook/main.ts&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;framework&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@storybook/react-vite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;stories&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../src/**/*.mdx&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../src/**/*.stories.@(js|jsx|ts|tsx)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  16. Update Sentry Configuration
&lt;/h3&gt;

&lt;p&gt;Update &lt;strong&gt;&lt;code&gt;vite.config.ts&lt;/code&gt;&lt;/strong&gt;: Additionally, to enhance the debugging process, we will upload source maps to Sentry.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;sentryVitePlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@sentry/vite-plugin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="nf"&gt;sentryVitePlugin&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;org&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="cm"&gt;/* &amp;lt;Sentry Org Name&amp;gt; */&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;project&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="cm"&gt;/* &amp;lt;Sentry Project Name&amp;gt; */&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;authToken&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="cm"&gt;/* &amp;lt;Sentry Auth Token&amp;gt; */&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;sourcemaps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;filesToDeleteAfterUpload&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./build/**/*.map&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;release&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="cm"&gt;/* &amp;lt;Your app release version or build no&amp;gt; */&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;filesToDeleteAfterUpload&lt;/code&gt;&lt;/strong&gt; option deletes the source map after the sourcemaps are uploaded to sentry&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  17. Remove CRA and Webpack-Related Configurations
&lt;/h3&gt;

&lt;p&gt;Finally, delete unnecessary Webpack-related files and dependencies, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remove &lt;strong&gt;&lt;code&gt;react-scripts&lt;/code&gt;&lt;/strong&gt; commands&lt;/li&gt;
&lt;li&gt;Uninstall Jest-related packages&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Uninstall the following Webpack-related dependencies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;webpack&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;webpack-bundle-analyzer&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Sentry webpack package : &lt;strong&gt;&lt;code&gt;@sentry/webpack-plugin&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Storybook webpack packages : &lt;strong&gt;&lt;code&gt;@storybook/builder-webpack5&lt;/code&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;@storybook/manager-webpack5&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://vitejs.dev/" rel="noopener noreferrer"&gt;Vite&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vitest.dev/" rel="noopener noreferrer"&gt;Vitest&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.robinwieruch.de/vite-create-react-app/" rel="noopener noreferrer"&gt;Migrate to Vite from Create React App (CRA)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Contribute
&lt;/h3&gt;

&lt;p&gt;If you feel any step can be improved, more details can be added, or new steps should be included, please feel free to contribute!&lt;/p&gt;

&lt;p&gt;Check out the repository and submit a pull request:&lt;br&gt;&lt;br&gt;
&lt;a href="https://github.com/sahillkumar/blogs/blob/main/src/vite/migration-step-guide.md" rel="noopener noreferrer"&gt;GitHub Repository&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>cra</category>
      <category>webpack</category>
      <category>vite</category>
    </item>
    <item>
      <title>Choosing the Right Chart Library</title>
      <dc:creator>Sahil Kumar</dc:creator>
      <pubDate>Sun, 16 Mar 2025 18:10:27 +0000</pubDate>
      <link>https://dev.to/sahi11k/choosing-the-right-chart-library-43k4</link>
      <guid>https://dev.to/sahi11k/choosing-the-right-chart-library-43k4</guid>
      <description>&lt;h2&gt;
  
  
  Importance of Data Analytics
&lt;/h2&gt;

&lt;p&gt;In a data-driven company, data analytics plays a crucial role in making informed decisions, optimizing operations, and predicting trends. It enables businesses to extract meaningful insights from raw data, leading to increased efficiency, improved customer experiences, and a competitive edge. Without proper analytics, organizations risk making decisions based on intuition rather than data-driven evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  📊 Role of Data Visualization
&lt;/h2&gt;

&lt;p&gt;A key component of analytics is &lt;strong&gt;Data Visualization&lt;/strong&gt;, which translates complex datasets into clear, interactive visuals such as charts and dashboards. Effective visualization helps identify patterns, correlations, and anomalies that might be overlooked in raw data. It also enhances communication by allowing stakeholders to quickly grasp insights and make faster, data-driven decisions.&lt;/p&gt;

&lt;p&gt;To implement data visualization effectively, a &lt;strong&gt;chart library&lt;/strong&gt; is required. The challenge, however, is choosing the right one. A quick online search for the best chart library will result in an overwhelming number of options. To the naked eye, most charting libraries appear similar apart from their aesthetics. &lt;strong&gt;However, aesthetics alone should not be the deciding factor.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So, how should one choose a chart library which is best suitable for their needs? 🤔&lt;br&gt;
In this blog, I will share some pointers that one should consider before choosing the right library.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔍 Key Factors to Consider
&lt;/h2&gt;

&lt;h3&gt;
  
  
  📈 Chart Types
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;What types of charts are required? (e.g., Line, Bar, Bubble, Area charts, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  📊 Dataset Size
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;How large is the dataset that needs to be visualized?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🎨 Customization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;How easily can the look and feel of the charts be modified?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  📱 Platform Compatibility
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Will the app be used on the web, mobile, or both?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🌍 Browser Support
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Does the library support all required browsers based on our user base?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ⚙️ JavaScript Framework Compatibility
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Does it integrate well with our tech stack (React, Vue, etc.)?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🖼️ Rendering Technology
&lt;/h3&gt;

&lt;p&gt;Rendering technology plays a crucial role in charting performance and interactivity. Many developers overlook how these technologies work internally and how they impact scalability and user experience. Below is a breakdown of the three primary rendering methods:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;SVG (Scalable Vector Graphics)&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Canvas (HTML5 Canvas API)&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;WebGL (Web Graphics Library)&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;How It Works&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Uses DOM elements for rendering vector graphics.&lt;/td&gt;
&lt;td&gt;Draws graphics pixel by pixel on a bitmap.&lt;/td&gt;
&lt;td&gt;Uses GPU acceleration to render graphics efficiently.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Performance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Slower with large datasets due to high DOM overhead.&lt;/td&gt;
&lt;td&gt;Faster than SVG, better suited for medium to large datasets.&lt;/td&gt;
&lt;td&gt;Extremely fast, capable of rendering millions of data points.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Interactivity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;High – Each element is a DOM node, making event handling easy.&lt;/td&gt;
&lt;td&gt;Moderate – Requires manual event handling for interaction.&lt;/td&gt;
&lt;td&gt;Low – Handling events requires extra effort.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Excellent – Scales without pixelation, ideal for zooming.&lt;/td&gt;
&lt;td&gt;Poor – Zooming in can cause pixelation.&lt;/td&gt;
&lt;td&gt;Excellent – Can handle complex, high-performance visualizations.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Customization&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Easy – Can be styled with CSS and animations.&lt;/td&gt;
&lt;td&gt;Moderate – Styling requires JavaScript manipulation.&lt;/td&gt;
&lt;td&gt;Complex – Requires custom shader programming for advanced effects.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Best For&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Small to medium datasets, business dashboards, interactive visualizations.&lt;/td&gt;
&lt;td&gt;Medium to large datasets, real-time updates, performance-heavy applications.&lt;/td&gt;
&lt;td&gt;Massive datasets, 3D visualizations, real-time simulations.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Examples&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://www.highcharts.com/" rel="noopener noreferrer"&gt;Highcharts&lt;/a&gt;, &lt;a href="https://d3js.org/" rel="noopener noreferrer"&gt;D3.js&lt;/a&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://www.chartjs.org/" rel="noopener noreferrer"&gt;Chart.js&lt;/a&gt;, &lt;a href="https://echarts.apache.org/" rel="noopener noreferrer"&gt;Apache ECharts&lt;/a&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;a href="https://www.scichart.com/" rel="noopener noreferrer"&gt;SciCharts&lt;/a&gt;, &lt;a href="https://lightningchart.com/js-charts" rel="noopener noreferrer"&gt;Lightning Chart&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  🏆 Conclusion
&lt;/h2&gt;

&lt;p&gt;Selecting a chart library is an important decision, whether for personal projects or enterprise-level data visualization. It's crucial to identify your needs and define what you expect from the library, considering factors like performance, customization, and ease of use.&lt;/p&gt;

&lt;p&gt;I hope this blog helps you make an informed decision when choosing the right charting library for your needs. With the right tool, you can create clear, effective, and visually appealing data visualizations that enhance decision-making and user experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  📄 References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://flatlogic.com/blog/best-19-javascript-charts-libraries/" rel="noopener noreferrer"&gt;Best 19+ JavaScript Chart Libraries to Use in 2024&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://imld.de/cnt/uploads/Horak-2018-Graph-Performance.pdf" rel="noopener noreferrer"&gt;Comparing Rendering Performance of Common Web Technologies for Large Graphs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>datavisualization</category>
      <category>charts</category>
      <category>dashboards</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
