michaelolof / vuex-class-component

A Type Safe Vuex Module or Store Using ES6 Classes and ES7 Decorators written in TypeScript.
217 stars 21 forks source link

Can't access this or module getters with Nuxt build #42

Closed danielroe closed 5 years ago

danielroe commented 5 years ago

I'm using version 2.0.4 and having a problem with post-build Nuxt projects, even if NODE_ENV=development. I'm getting:

ERROR  Cannot read property 'firstname' of undefined
  at a.classState (2bcd2f8370f6c4fde98e.js:1:0)
  at a.classState (node_modules/vue/dist/vue.runtime.common.prod.js:6:29698)
  at a.<anonymous> (2bcd2f8370f6c4fde98e.js:1:0)
  at a.t._render (node_modules/vue/dist/vue.runtime.common.prod.js:6:35273)
  at node_modules/vue-server-renderer/build.prod.js:1:70663
  at Yi (node_modules/vue-server-renderer/build.prod.js:1:67227)
  at io (node_modules/vue-server-renderer/build.prod.js:1:70639)
  at ro (node_modules/vue-server-renderer/build.prod.js:1:70270)
  at eo (node_modules/vue-server-renderer/build.prod.js:1:67517)
  at node_modules/vue-server-renderer/build.prod.js:1:70737

To replicate, see my previous repro, which I've simply updated to the latest version - and run yarn build && yarn start.

See #41.

domi91c commented 5 years ago

I seem to be unable to call any actions when running npm run build; npm run start. Everything is working fine in development, but no luck in production.

danielroe commented 5 years ago

Duplicate of #43 - which I think is a better description of the underlying issue.

This workaround solves the problem I was reporting.