Is vue3+meteor dead? I can't build it

just typed

meteor create --vue test-vue
cd ./test-vue
meteor build ../ --architecture os.linux.x86_64

I didn’t touch any code. But I got build error.

I worked on a MacBook M2 Air.

Ok, you have an error there. Could you check on that? Do you (the default code) import anything after a constant/variable declaration or lower down in your view/component?

I’m interested to see if this can be resolved. Will soon start converting my app from vue 2 to vue 3. Since the vite integration only got published a while back, it seems possible that perhaps you have uncovered an issue that has gone unnoticed until now. Could you please open an issue about it here: Issues · meteor-vue/vue-meteor-tracker · GitHub

After quite some looking around i finally found the solution…
It’s as simple as not using dynamic imports in the router.js.
Sent a pull request for the example repository Fix build "terser minification error" by nooitaf · Pull Request #2 · henriquealbert/meteor-vue3 · GitHub

In short change imports/ui/router.js from …

import { createRouter, createWebHistory } from 'vue-router'
import Home from './Home.vue'

export const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('./About.vue'),
    },
  ],
})

To…

import { createRouter, createWebHistory } from 'vue-router'
import Home from './Home.vue'
import About from './About.vue'

export const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
    },
    {
      path: '/about',
      name: 'about',
      component: About
    },
  ],
})

Even though i managed to get it built and deploy without errors, it doesn’t seem to work with meteor --production.

For some reason It never actually subscribes to the links collection :\

$ meteor


$ meteor --production

I ran into exactly this issue today with a fresh install. I havent got a solution but wanted to raise its visibility as presumably it stops people using 2.12 with vue in production.

I did some more digging into this and I found two things:

  • I can replicate the “cannot use meteor run --production with vue3 project” issue by testing the vue3 template project in all versions of meteor that support a vue3 template (once Ive fixed the dynamic import so that it builds) - I assume this means its never worked for vue3
  • it doesnt affect galaxy or mup deployments - you can deploy to production even though you cant test the production build locally

so I conclude that this issue doesnt stop people using vue3 in production but it makes the testing harder.