feat: migrate Vue 2 to Vue 3 via @vue/compat (MODE 2)#314
feat: migrate Vue 2 to Vue 3 via @vue/compat (MODE 2)#314AgustinRamiroDiaz wants to merge 15 commits intoSTS-Rosario:masterfrom
Conversation
9e1a947 to
970f032
Compare
|
@GonzaloGM ready for review! If we go ahead with this PR, then we can go module by module with the upgrades to vue3 🥳 |
|
@AgustinRamiroDiaz thanks a lot! It looks good but it seems there are some visual changes. For example I see that the font used is Avenir when we're using Roboto. Also, texts seem centered by default, we should make them left aligned. We have some graphs in admin that aren't working, but not sure if that was planned for a later PR, it'd be good to have it now so we don't lose visibility of that for admins in the migration. |
|
@GonzaloGM fixed alignment, I'm now reading about the graphs in admin |
|
@AgustinRamiroDiaz Yeah that sounds great, thanks! |
|
@AgustinRamiroDiaz I checked the PR, this looks good, once the graphs are fixed we can merge I think! |
|
@GonzaloGM I've addressed those issues. Check the admin panel now |
|
I'll be creating issues for all the upgrades for the packages so that we can remove vue/compat |
|
@AgustinRamiroDiaz Great I'll test it, the individual issues descriptions have the description missing I Think? or where are those issues .md files? |
damn, I'll fix that Also, do you know how can I test Capacitor? |
|
@AgustinRamiroDiaz these are the commands I used to build the apps in my devices: BUILD ANDROID: cd ~/Work/carpoolear/carpoolear && npm run build:android && cp -r dist/default/production/www/* www/ && npx cap run android --target d59fb3c7 /Users/gonzalogm/Work/carpoolear/carpoolear/android/app/build/outputs/bundle/release you'll have to change your device IDs though /EDIT: this is what I used for building Android for the store, not sure about iOS as I wasn't able to build it because Apple doesn't allow multiple building devs in individual accounts (Pablo did). cd ~/Work/carpoolear/carpoolear && npm run build:android && cp -r dist/default/production/www/* www/ && cd ~/Work/carpoolear/carpoolear/android/ && ./gradlew bundleRelease I was able to build for Android, I'll see if Pablo can test building in iOS and we can merge. |
|
thanks! I've installed android studio and configured my machine. I was able to emulate the android build 🥳 I don't have IOS to test :( |
|
@GonzaloGM tested on android and it seems to be working 👍
|
|
@AgustinRamiroDiaz I usually just change the API backend to an ngrok and test locally, but it that makes it work with localhost and prod, great! :) |
|
@AgustinRamiroDiaz I tried testing the Sellado which is a new feature not enabled in public now, but already in (anonymous) @ app.d2c265a3200347f01b92.js:1Understand this error walletButton.js:1 This is on a trip detail page in a trip that has sellado (Rosario->Buenos Aires with sellado enabled in backend). There should be a MP payment button (the classic yellow one) but it doesn't load and gives that error. If I switch to This is working in |
|
@GonzaloGM could the Sellado issue be due to this branch not being up to date with master? I'll rebase and try that I'd be happy to improve our communication through discord |
7d0b9ce to
58f1fe0
Compare
|
converting to draft until I fix the Sellado feature |
58f1fe0 to
0df5a22
Compare
Migrate the frontend to Vue 3 using the compatibility build (@vue/compat) in MODE 2, which preserves Vue 2 behavior while enabling the Vue 3 runtime. All existing components, plugins, and patterns continue to work as-is with deprecation warnings in the console. Key changes: - Update vue, vuex, vue-router, vue-i18n, vue-loader to Vue 3 ecosystem - Use createApp/createStore/createRouter/createI18n APIs - Extract i18n config to src/i18n.js to break circular dependency - Fix v-for/v-if priority change in HeaderApp.vue (Vue 3 breaking change) - Fix bus-event.js for Vue 3 compat (_events internal property) - Fix template :key placement in Trip.vue for Vue 3 compiler - Update catch-all route to Vue Router 4 syntax - Pin vue-router@4.3.3 (4.4+ uses optional chaining unsupported by Babel 6) - Upgrade Dockerfile from Node 12 to Node 18 - Remove stale margin-top: 60px on #app Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add .npmrc with legacy-peer-deps=true to fix npm ci failure caused by vue2-google-maps requiring vue@^2 as peer dep. Update old slot="name" syntax to #name in HeaderApp.vue so vue-strap dropdown slots render correctly under Vue 3 compat. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Vue 3 compat mode does not properly handle the old slot="name" attribute syntax on non-template elements, causing slot content to fall into the default slot. This made Loading states (no-data, loading) always visible and modal header/body slots render incorrectly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…8n keys Consolidate two separate `import` from 'vue' into one to fix import/no-duplicates. Remove 15 duplicate translation keys across arg/chl/en locales in i18n.js to fix no-dupe-keys (pre-existing on master). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract dismissOverlays and uiLogin into shared e2e/helpers.js - Replace API-based cleanup with UI interactions (Cancelar Viaje button) - Remove API_URL constants from test files - Use user9 as driver in trip-request-flow to isolate from create-trip test - Add try/catch in route.fetch handlers to prevent context disposal errors - Increase login redirect timeouts to 15s for parallel stability Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace bind/unbind with beforeMount/unmounted (Vue 3 lifecycle hooks) - Use binding.value instead of vnode.context[binding.expression] (vnode.context was removed in Vue 3) - Add Playwright test that reproduces and verifies the fix
e5b2071 to
3bf235f
Compare
|
@GonzaloGM I was able to test almost the entire flow, but I'm missing the callback since I cannot run 2 ports with ngrok I have been able to
How do you have the setup done with ngrok? |
Summary
Migrate frontend from Vue 2 to Vue 3 using
@vue/compatin MODE 2 (Vue 2 behavior preserved). All ~80 existing.vuecomponents, Vue 2 plugins, filters, directives, and event bus continue working as-is under compat mode with deprecation warnings in the console.Core migration changes
package.json@vue/compat,@vue/compiler-sfc,entities; pin vue-router@4.3.3build/webpack.base.conf.jsvue→@vue/compatalias, vue-loader compat optionssrc/i18n.jssrc/store/index.jsnew Vuex.Store()→createStore()src/router/index.jsnew VueRouter()→createRouter()withcreateWebHashHistorysrc/router/routes.js/*→/:pathMatch(.*)*src/main.jscreateApp()+app.use()mounting; removed inline i18n setupsrc/services/bus-event.js_eventsaccess (undefined in Vue 3 compat)Dockerfile--legacy-peer-deps --ignore-scriptsfor Vue 2 plugin compatVue 3 syntax fixes
src/components/sections/HeaderApp.vuev-for/v-ifpriority (Vue 3 evaluatesv-iffirst); updateslot="name"→#namefor dropdown/modal slotssrc/components/views/Trip.vue:keyfrom child to<template v-for>src/App.vuemargin-top: 60pxon#appslot="name"syntax to<template #name>— compat mode does not handle this correctly, causing Loading states and modal slots to render in the wrong placeCI & config
.npmrclegacy-peer-deps=true— fixesnpm cifailure from vue2-google-maps peer dep conflict.gitignore.envWhat stays unchanged (compat handles it)
.vuecomponent logic ($set,beforeDestroy,Vue.filter(),Vue.prototype,Vue.directive(), etc.)$on/$off/$emit)Test plan
npm run devcompiles successfully (deprecation warnings only, 0 errors)npm run build— production build succeeds🤖 Generated with Claude Code