Comments (27)
I think this is a very good example of how to use https://github.com/Armour/vue-typescript-admin-template
from vuex-module-decorators.
v0.8.0 - all ok
v0.9.0 - occurs this error (Class constructor VuexModule cannot be invoked without 'new')
from vuex-module-decorators.
@ruifigueira
In that case
transpileDependencies: ['vuex-module-decorators']
in your vue.config.js should work
from vuex-module-decorators.
Can you show the code ?
from vuex-module-decorators.
It's example with counter from README
from vuex-module-decorators.
Just upgraded to 0.5.0 and I'm also getting this. I think a full working sample application in this repo would be extremely useful.
from vuex-module-decorators.
I'm experiencing the same issues after upgrading to 0.5.0
@Module({ namespaced: true })
export class VacationCalendarVuexModule extends VuexModule {
...
}
it produces the following error
Uncaught TypeError: Class constructor VuexModule cannot be invoked without 'new'
at new VacationCalendarVuexModule (vacation-calendar.ts:78)
at Object.stateFactory (stateFactory.js:4)
at stateFactory (index.js:8)
at eval (index.js:10)
at __decorate (vacation-calendar.ts:40)
at eval (vacation-calendar.ts:137)
at Object../ClientApp/store/modules/vacation-calendar.ts (bootstrap:791)
at __webpack_require__ (bootstrap:724)
at fn (bootstrap:101)
at eval (index.ts:7)
Inspecting the line at vacation-calendar.ts:78 for me shows this
_this = _possibleConstructorReturn(this, _getPrototypeOf(VacationCalendarVuexModule).apply(this, arguments));
specifically the .apply
seems to be failing.
"@babel/core": "^7.0.0-beta.54",
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.54",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.54",
"@babel/plugin-transform-runtime": "^7.0.0-beta.54",
"@babel/polyfill": "^7.0.0-beta.54",
"typescript": "^3.0.3",
"vue": "^2.5.16",
"vuex": "^3.0.1",
"vuex-class": "^0.3.1",
from vuex-module-decorators.
the same issue,look forward to come out a solution
from vuex-module-decorators.
most likely to work fine with v0.6.0
from vuex-module-decorators.
This error also occurs when use version 0.6.0
from vuex-module-decorators.
yes, the error occurs at version 0.6.0 as the same
from vuex-module-decorators.
Can you guys show me your webpack/rollup configs ? I feel this is a es6 -> es5 transpilation level issue
from vuex-module-decorators.
v0.7.1 really totally fixes this. I finally figured out what the issue was
from vuex-module-decorators.
from vuex-module-decorators.
I had the same issue, I even tried transpileDependencies: ['vuex-module-decorators']
but it didn't work.
I had to use 0.8.0 version instead (thanks @KleinMaximus!).
from vuex-module-decorators.
are you using Typescript only or Typescript + Babel setup ?
from vuex-module-decorators.
Typescript + Babel (I used vue-cli for the setup).
from vuex-module-decorators.
I have same issue.
My TS transpile option is 'esnext'. and i had 0.9.0 version.
but i set transpileDependencies: ['vuex-module-decorators']
, then it's works.
from vuex-module-decorators.
I have 0.9.0 installed and I tried adding this to my vue.config.js
module.exports = {
transpileDependencies: ['vuex-module-decorators']
}
still get the error and my tsconfig looks like this:
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env",
"mocha",
"chai",
"vuetify"
],
"paths": {
"@/": [
"src/"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src//*.ts",
"src//.tsx",
"src/**/.vue",
"tests//*.ts",
"tests//*.tsx"
],
"exclude": [
"node_modules"
]
}
from vuex-module-decorators.
And FYI 0.8.0 works, no issues.
from vuex-module-decorators.
transpileDependencies: ['vuex-module-decorators']
works for me
from vuex-module-decorators.
@championswimmer what i have to do if I dont use vue-cli and my tsconfig target is es5?
from vuex-module-decorators.
Depending on your tool you need to make sure your transpiler transpiles this module vuex-module-decorators
too.
If ES5 support is not utterly essential, you can make your entire project target es2015, in which case the library will work as it is.
from vuex-module-decorators.
@KleinMaximus with .90?
@championswimmer this is all I have in my vue.config.js
module.exports = {
transpileDependencies: ['vuex-module-decorators']
}
from vuex-module-decorators.
I also meet this problem when updating my code, add transpileDependencies: ['vuex-module-decorators']
fix it.
https://github.com/Armour/vue-typescript-admin-template now is with the latest version of vuex-module-decorators
from vuex-module-decorators.
@aceven24 Did you ever solve this? I just created a new TypeScript project with the latest Vue CLI yesterday, and whether or not I set transpileDependencies
in my vue.config.js
makes no difference.
EDIT: Never mind, it does work. Ended up being a caching issue. Do note that you'll also need babel.config.js
for transpileDependencies
to work.
from vuex-module-decorators.
Everyone please vote here #68
Need your opinions
from vuex-module-decorators.
Related Issues (20)
- MutationAction not working with RemoteData union type
- got error when use @Mutation in app.config.errorHandler HOT 2
- MutationAction not having access to module state? HOT 5
- How can I split up an module-class HOT 1
- Conflict with NuxtJS third-party modules HOT 2
- When will you release the new version ?
- MutationAction still not works HOT 2
- peer vuex@"3" from [email protected] HOT 3
- Setting an object through MutateAction throws an exception HOT 3
- Action method question HOT 1
- Missing github release and changelog for v2 HOT 2
- v2.0.0 there are any breaking changes ? HOT 2
- Can vite hot update be supported?
- How can I use Try catch inside @MutationAction?
- in @Mutation,this is undefined HOT 1
- In @Mutation, how to call another Mutation, this.xxx is undefined HOT 1
- vue.reactive is not a function (Nuxtjs, Typescript)
- MutationAction never commits changes, if component switched
- Using vuex-module-decorators with vue2 HOT 1
- fix: support typescript 4.8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vuex-module-decorators.