DEV Community

Cover image for Navigating the Vue 2 to Vue 3 Migration: Lessons Learned and Key Considerations
Samuel Anyaele
Samuel Anyaele

Posted on

Navigating the Vue 2 to Vue 3 Migration: Lessons Learned and Key Considerations

At Cargoplug, we recently embarked on a journey to upgrade our frontend from Vue 2 to Vue 3, a process we initially estimated would take about 4 weeks (2 sprints). However, as many of you in the tech space know, software upgrades rarely go as planned. What we thought would be a straightforward migration turned into a 3-month endeavor filled with challenges, learning opportunities, and ultimately, a successful outcome.

Why Nuxt? The SEO Advantage

Our frontend is built on Nuxt, a framework derived from Vue.js, and for good reason. As a company building its brand presence online, Search Engine Optimization (SEO) is critical to our strategy. Nuxt’s server-side rendering (SSR) capabilities ensure that search engine robots can crawl and index our content effectively, unlike Single Page Applications (SPAs) built with Vue.js, which often appear empty to search bots.

Even as large language models (LLMs) and AI-driven search tools gain traction, SEO remains a powerful tool for capturing long-term market share. This made Nuxt the ideal choice for our frontend, as it aligns with our goal of maintaining a strong online presence.

The Need to Upgrade: Vue 2 and Nuxt 2 End of Life

With Vue 2 reaching its End of Life (EOL) on December 31, 2023, and Nuxt 2 following suit with an EOL of June 30, 2024, we had no choice but to upgrade. What we didn’t anticipate, however, were the complexities involved in this migration. Here are some of the key challenges we faced:

  1. State Management: Vuex to Pinia

    One of the biggest hurdles was migrating our state management from Vuex to Pinia. While Vuex struggled with Nuxt 3, Pinia offered a more compatible and modern solution. However, the underlying principles of the two libraries are fundamentally different, requiring significant refactoring and a shift in mindset.

  2. Custom-Built Functionalities

    To avoid current and future complications, we decided to build custom functionalities for Axios, middlewares, and stores. This approach, while time-consuming, gave us greater control and flexibility over our codebase.

  3. Functional Programming Over OOP

    As we delved deeper into Vue 3 and Nuxt 3, it became clear that the framework is leaning more toward functional programming. This required our developers to adapt their thinking and coding practices, moving away from traditional object-oriented programming (OOP) paradigms.

The Silver Linings

Despite the challenges, the migration brought several benefits:

  • Future-Proofing Our Codebase: We now have peace of mind knowing we’re no longer relying on outdated software.
  • Dockerizing Our Frontend: As part of the upgrade, we containerized our frontend using Docker. This streamlined our CI/CD pipelines, allowing us to use GitHub Runners to build the app and push it to DockerHub. Not only did this reduce the load on our VMs, but it also cut down on resource usage and cloud costs.

Lessons Learned

While the migration was far from smooth, it taught us valuable lessons about planning, adaptability, and the importance of staying ahead of technology curves. We’re still encountering occasional bugs, and our testing and release history has taken a hit, but the long-term benefits far outweigh the short-term pains.

Final Thoughts

For any team considering a similar upgrade, my advice is to plan for the unexpected. Allocate more time than you think you’ll need, and be prepared to rethink your approach to state management, architecture, and even programming paradigms.

At Cargoplug, we’re proud of what we’ve accomplished and excited about the opportunities this upgrade opens up for our platform. If you’ve gone through a similar migration, I’d love to hear about your experience and any tips you might have!

Vue3 #Nuxt3 #FrontendDevelopment #SEO #SoftwareMigration #TechUpgrades #Cargoplug

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs