Vue compatible with Meteor 1.8

Hey guys. Just to let everyone know, yesterday @akryum merged a PR which should fix the bug in vue-component that caused an endless reload loop with Meteor 1.8. So in other words, Vue and the latest Meteor release should now work nicely together. Many thanks, @akryum!

14 Likes

It fixes the continuous reload issue. I’m now trying to fix the HMR part, but its hard to get it to work properly with Meteor’s autorefresh functionality. Anyone able to help me out a bit?

I figured that the _watchPath function is not properly triggered / re-triggered in the vue-compiler file and managed to get it working partially by doing this in the function:

    this.filePath = filePath
    // Fast file change detection
    this._closeWatcher()
    this.watcher = fs.watch(filePath, {
      persistent: false,
    })
    this.watcher.on('change', _.debounce(event => {
      this.refresh() // Triggers a HMR
    }, 100))
    this.watcher.on('error', (error) => console.error(error))

Now, by disabling the reload call in the dev-client, the HMR works flawlessly when I change things in the component template parts:

function checkNewVersionDocument (doc) {
  if (doc && doc.version && doc._id && __meteor_runtime_config__.autoupdate.versions[doc._id]) {
    if (__meteor_runtime_config__.autoupdate.versions[doc._id].version !== doc.version) {
      // reload()
    }
  }
}

However, not on the javascript part. If I for example try to change a data prop like below, it will not send a HMR and ofcourse it will also not refresh:

<script>
  export default {
    data() {
      return {
        date: new Date(),
      };
    }
  }
</script>

Changed it to:

<script>
  export default {
    data() {
      return {
        date: 'test',
      };
    }
  }
</script>

Above change will not be reloaded.

I either want to make it fall back to the normal full refresh, but ideally just have it working like it does for example on Nuxt. Anyone that is able to help me on this? @akryum @vooteles?

Glad to see you rolling up your sleeves, @cloudspider . Unfortunately can’t say the same about myself - for at least the next couple of months I will be mostly MIA.

@cloudspider, if by the ‘HMR part’ you refer to the extra page reload, that is triggered by the new Meteor split-build in development, where the legacy-browser build is delayed a second or two. If that is so, have you tried https://github.com/qualialabs/one ? Works fine for me.

Nope. Doesnt work for me. :frowning:

I found it! I will make a PR now:

1 Like