Skip to content

Vuex breaks with Vue 3.x upgrade #1683

Closed
@sonicoder86

Description

@sonicoder86

Version

3.1.2

Reproduction link

https://github.com/blacksonic/todoapp-vue/tree/vue3

Steps to reproduce

vue add vue-next
try to use the Vuex plugin on the instance returned from createApp

What is expected?

Vuex plugin added to the app instance

What is actually happening?

The app breaks with console error:

vuex.esm.js?2f62:7 Uncaught TypeError: Cannot read property 'split' of undefined
at applyMixin (vuex.esm.js?2f62:7)
at Object.install (vuex.esm.js?2f62:824)
at Object.use (runtime-core.esm-bundler.js?5c40:1709)
at eval (main.js?56d7:8)
at Module../src/main.js (app.js:1246)
at webpack_require (app.js:786)
at fn (app.js:151)
at Object.1 (app.js:1356)
at webpack_require (app.js:786)
at checkDeferredModules (app.js:46)


Which leads to the point where it tries to determine the Vue version from the global Vue instance, which is non-existent.

var version = Number(Vue.version.split('.')[0]);
Any suggestions on how to add Vuex to Vue 3 projects?
There is an exported variable in Vue 3 called version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions