championswimmer / vuex-module-decorators

TypeScript/ES7 Decorators to create Vuex modules declaratively
https://championswimmer.in/vuex-module-decorators/
MIT License
1.8k stars 170 forks source link

Support Vuex 4 #357

Closed UDK closed 2 years ago

UDK commented 3 years ago

Hi) Can you please tell me, I have such a mistake:

11 2.880 npm ERR! code ERESOLVE

11 2.885 npm ERR! ERESOLVE unable to resolve dependency tree

11 2.885 npm ERR!

11 2.885 npm ERR! While resolving: client@0.1.0

11 2.885 npm ERR! Found: vuex@4.0.0

11 2.886 npm ERR! node_modules/vuex

11 2.886 npm ERR! vuex@"^4.0.0-0" from the root project

11 2.886 npm ERR!

11 2.886 npm ERR! Could not resolve dependency:

11 2.886 npm ERR! peer vuex@"3" from vuex-module-decorators@1.0.1

11 2.887 npm ERR! node_modules/vuex-module-decorators

11 2.887 npm ERR! dev vuex-module-decorators@"^1.0.1" from the root project

11 2.887 npm ERR!

11 2.887 npm ERR! Fix the upstream dependency conflict, or retry

11 2.887 npm ERR! this command with --force, or --legacy-peer-deps

11 2.887 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

11 2.888 npm ERR!

11 2.888 npm ERR! See /root/.npm/eresolve-report.txt for a full report.

11 2.898

11 2.898 npm ERR! A complete log of this run can be found in:

11 2.898 npm ERR! /root/.npm/_logs/2021-04-13T13_58_19_924Z-debug.log

I understand correctly that this is due to the fact that vuex-module-decorators does not support vuex 4. If so, tell me whether it will support it or it is not yet in the plans?

gLenczuk commented 3 years ago

It's strange, because I'm using VueX 4.0.0 with vuex-module-decorator. Here is my package.json:

  "dependencies": {
    "@inboxed/common": "^1.0.0",
    "axios": "^0.21.1",
    "babel-plugin-transform-decorators": "^6.24.1",
    "core-js": "^3.6.5",
    "primeicons": "^4.1.0",
    "primevue": "^3.3.5",
    "socket.io-client": "^3.1.0",
    "vue": "^3.0.0",
    "vue-i18n": "^9.0.0-rc.6",
    "vue-router": "^4.0.0-0",
    "vuex": "^4.0.0-0",
    "vuex-module-decorators": "^1.0.1"
  },

I will try to investigate it. Can you provide more informations about your project? Is it fresh project created with vue-cli?

UDK commented 3 years ago

Hi @gLenczuk My dependencies package.json

"dependencies": { "axios": "^0.21.1", "core-js": "^3.6.5", "primeflex": "^2.0.0", "primeicons": "^4.1.0", "primevue": "^3.3.5", "vue": "^3.0.0", "vue-class-component": "^8.0.0-0", "vue-router": "^4.0.0-0", "vue-toastification": "^2.0.0-rc.1", "vuex": "^4.0.0-0", "vuex-module-decorators": "^1.0.1" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^4.22.0", "@typescript-eslint/parser": "^4.22.0", "@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-typescript": "~4.5.0", "@vue/cli-plugin-vuex": "~4.5.0", "@vue/cli-service": "~4.5.0", "@vue/compiler-sfc": "^3.0.0", "@vue/eslint-config-standard": "^5.1.2", "@vue/eslint-config-typescript": "^7.0.0", "babel-eslint": "^10.1.0", "eslint": "^6.8.0", "eslint-config-prettier": "^6.15.0", "eslint-plugin-import": "^2.20.2", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier-vue": "^3.0.0-alpha.2", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-standard": "^4.0.0", "eslint-plugin-vue": "^7.8.0", "prettier": "^2.2.1", "sass": "^1.26.5", "sass-loader": "^8.0.2", "typescript": "~3.9.3" },

The project is new and created using the vue-cli

kristofer-w2w commented 3 years ago

The package.json in version 1.0.1 does instead specify vuex as a devdependency at ^3.1.1, so that does not include version 4. I have the same problem as original poster. By the same token, it also does not support Vue 3.

glen-84 commented 3 years ago

@championswimmer Any plans to update this library for Vuex 4?

tony-nz commented 3 years ago

@gLenczuk did you find anything? I have a project that is currently working fine with this configuration, where as a new one today seemed to fail. Are there any work arounds?

LuisMiguelFilipe commented 3 years ago

AFAIK this warning comes from the peerdependency here It claims it only works with vuex3. Has this been tested with vuex4? Any caveats I should worry about?

prutheus commented 3 years ago

What is the state about this issue right now?

timnick-snow commented 3 years ago

Hope to support Vue 3, Vuex 4

AlienDwarf commented 3 years ago

4 Month passed now. Still having this issue. Is there any workaround?

mockingjet commented 3 years ago

I have used vuex-module-decorators for several months. And it's still bound to the concept of Vuex although it provides support of typescript and some advantages. But now I am going to use pinia, a composition-api style library for Vue2 & 3 state management. Since this repo has not been updated for nearly a year, for anyone who is worried about using this library, I recommend you give pinia a try in the new project.

snarcraft commented 2 years ago

@mockingjet thanks man 🙏🏻 pinia 😍

d2phap commented 2 years ago

no update 😪

championswimmer commented 2 years ago

Thanks everyone for pinning hopes on this. I have released v2.0 of this library that officially supports vue 3 + vuex 4.

Please install vuex-module-decorators@2 if you want to use that.

guillaumeduhan commented 2 years ago

@d2phap I found a solution that worked for me:

npm i vuex-module-decorators --legacy-peer-deps

Please try and tell me :)

d2phap commented 2 years ago

Thanks @guillaumeduhan I already decided not to use a decorator. Maybe I will come back and set up in my next project.

jeffersongrassine commented 2 years ago

Funcionou aqui: npm i vuex-module-decorators --legacy-peer-deps