Frontend Development 8 min read

Automating Vue2‑to‑Vue3 Migration with GoGoCode: A Practical Guide

This article explains how to use the GoGoCode AST‑based tool to automate the migration of large Vue 2 codebases to Vue 3, covering installation, command‑line usage, sample transformation rules, supported API changes, and where to find documentation and source code.

Top Architect
Top Architect
Top Architect
Automating Vue2‑to‑Vue3 Migration with GoGoCode: A Practical Guide

Vue 3 has been released for a while, but many developers still maintain massive Vue 2 projects and find full‑stack upgrades daunting. The official migration guide lists many breaking changes, many of which require repetitive manual edits such as wrapping async components or renaming custom directive lifecycles.

To alleviate this pain, the author introduces GoGoCode , an AST‑based code‑mod tool that can batch‑apply the migration rules. After a brief recap of the migration guide, the article shows how GoGoCode was previously described in another post and how it now supports Vue‑specific transformations.

Installation

npm install gogocode-cli -g

Run the CLI in the project directory to transform all Vue files:

gogocode -s ./src -t gogocode-plugin-vue -o ./src-out

The transformed Vue 3 code is written to src-out . Using the official vue-hackernews-2.0 demo, the author demonstrates that after conversion only minor adjustments to the build process are needed, and shows a diff of the changes.

The article lists the conversion rules that have been implemented (about 30 rules), covering most break‑change scenarios such as async components, custom directives, data/options, emits, event API, filters, fragments, functional components, global API, v‑model, v‑if/v‑for priority, v‑bind merging, watch on arrays, vuex, vue‑router, etc. A table summarises each rule, whether it is supported, and links to detailed documentation.

Finally, the author invites the community to give feedback via the GitHub issue tracker, provides links to the repository, documentation site, and mentions that the tool also now parses .vue files to access template and script AST nodes.

References include the official Vue migration guide, the GoGoCode GitHub repo, the original article about the tool, and various related resources.

frontendMigrationASTVueVue3toolGoGoCode
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.