dwqs / vue-mobx

:smile: :star: :innocent: Mobx binding for Vuejs 2.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vue-mobx code is minified

scott-cornwell opened this issue · comments

I'm trying to get vue-mobx to work and can't tell what's wrong. I get this error:

Cannot read property 'isObservable' of undefined

It would be helpful if the code was not minified so I could get meaningful errors. The build that uses vue-mobx should be responsible for minifying if desired. I'm not really sure what I'm doing wrong, I tried following your example with a simple app I set up with vue-cli. The error is thrown from within the vue-mobx code. I tried with the latest versions of vue, mobx, and vue-mobx, and also with the exact versions of vue and mobx you have in your package.json. I'm not sure if your example is actually runnable, as you have a store variable passed in to the Vue instance that doesn't get defined anywhere. I did pass in toJS, isObservable, and observable from Mobx like this:

import Vue from 'vue'
import { observable, isObservable, toJS } from 'mobx'
import VueMobx from 'vue-mobx'

Vue.use(VueMobx, {
  toJS: toJS,
  isObservable: isObservable,
  observable: observable
})

Any ideas?

Update: I tried switching to vue-mobx 1.0.0 and the error is gone now. Maybe a regression in the newer versions? Thanks for your work on this! I think it's really great to have state management that isn't tied to the view layer.

commented

What's the version of mobx you used ?

3.2.2 now but I had it on the latest originally. Now I am struggling with getting two components to store the same mobx state. They both seem to have their own independent state even thought they are using the same store :/ If you have a working example of components sharing the same mobx model/store it would be much appreciated!

commented

I used vue-startup template to generate a example project, you can try it.

two components to store the same mobx state,They both seem to have their own independent state even thought they are using the same store

This is a bug, and I will as soon as try to fix it . Thanks your feedback

commented

@scott-cornwell you can try to use movue. Maybe it meets your demand. vue-mobx was deprecated.