Lucas_Werkmeister_WMDE added a comment.

  > I thought this would be a problem with WVUI, but from my testing, the Vue 
2-compiled WVUI bundle works just fine under the Vue 3 migration build. The 
compatibility that the migration build provides for the render function API is 
good enough that compiled templates work. I wouldn't trust this blindly without 
testing, but it has worked for us for the (relatively simple) Vue 2 code in 
WVUI.
  
  Hm, then I’ll go into a bit more detail. My first attempt had been to use Vue 
3 at build time, but that didn’t work with a Vue 2 runtime (incompatible 
templates). I assumed that Vue 2 compiled templates wouldn’t work against a Vue 
3 runtime either, but I didn’t actually reach the point where I got an error 
for that.
  
  The latest problem I had was that we export components as `export default 
Vue.extend( { /* options */ } )` to make TypeScript type inference work 
properly. (This fulfills a similar function to `Vue.defineComponent()` in Vue 
3.) However, `createMwApp()` already calls `Vue.extend()` on the options it 
receives, and `Vue.extend()` isn’t idempotent (unlike `Vue.defineComponent()`), 
so we need to pass the original options into `createMwApp()`, not the extended 
Vue constructor. In Vue 2, this worked by passing in `App.extendOptions` (the 
original options, which `Vue.extend()` attaches to the returned constructor), 
but in the compatibility build’s version of `Vue.extend()`, that doesn’t 
happen, and when I tried to add it (wrap the compatibility build’s 
`Vue.extend()` with a function that attaches the argument as `extendOptions` to 
the original return value), the template was missing (I don’t know exactly how 
the SFC build attaches `<template>` and `<style>` to the options, but they 
weren’t there).
  
  It’s possible that this problem is solvable – this is just the point where I 
realized that running Vue 2 compiled templates against Vue 3 would probably 
work no better than the earlier attempt of Vue 3 compiled templates crashing on 
Vue 2, so I abandoned that line of work and instead tried including Vue 2 in 
the build, which works fairly well. Maybe we can come back to the 
`Vue.extend()` problems, but the solution with bundled Vue at least seems like 
a viable way forward.

TASK DETAIL
  https://phabricator.wikimedia.org/T294465

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: karapayneWMDE, Michael, Lucas_Werkmeister_WMDE, Aklapper, Catrope, 786, 
Suran38, Biggs657, Invadibot, Lalamarie69, maantietaja, Juan90264, Alter-paule, 
Beast1978, Un1tY, Akuckartz, Sarai-WMDE, Hook696, darthmon_wmde, Kent7301, 
joker88john, CucyNoiD, Nandana, Gaboe420, lucamauri, Giuliamocci, Cpaulf30, 
Lahi, Gq86, Af420, Bsandipan, GoranSMilovanovic, Mahir256, QZanden, 
LawExplorer, Lewizho99, Maathavan, _jensen, rosalieper, Bodhisattwa, 
Scott_WUaS, Wikidata-bugs, aude, Lydia_Pintscher, Addshore, Mbch331
_______________________________________________
Wikidata-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to