Code Monkey home page Code Monkey logo

Comments (27)

championswimmer avatar championswimmer commented on May 13, 2024 3

I think this is a very good example of how to use https://github.com/Armour/vue-typescript-admin-template

from vuex-module-decorators.

KleinMaximus avatar KleinMaximus commented on May 13, 2024 2

v0.8.0 - all ok
v0.9.0 - occurs this error (Class constructor VuexModule cannot be invoked without 'new')

from vuex-module-decorators.

championswimmer avatar championswimmer commented on May 13, 2024 1

@ruifigueira
In that case

transpileDependencies: ['vuex-module-decorators'] 

in your vue.config.js should work

from vuex-module-decorators.

championswimmer avatar championswimmer commented on May 13, 2024

Can you show the code ?

from vuex-module-decorators.

abdullaev avatar abdullaev commented on May 13, 2024

It's example with counter from README

from vuex-module-decorators.

jculverwell avatar jculverwell commented on May 13, 2024

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.

bederuijter avatar bederuijter commented on May 13, 2024

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.

Yongd avatar Yongd commented on May 13, 2024

the same issue,look forward to come out a solution

from vuex-module-decorators.

championswimmer avatar championswimmer commented on May 13, 2024

most likely to work fine with v0.6.0

from vuex-module-decorators.

KleinMaximus avatar KleinMaximus commented on May 13, 2024

This error also occurs when use version 0.6.0

from vuex-module-decorators.

Yongd avatar Yongd commented on May 13, 2024

yes, the error occurs at version 0.6.0 as the same

from vuex-module-decorators.

championswimmer avatar championswimmer commented on May 13, 2024

Can you guys show me your webpack/rollup configs ? I feel this is a es6 -> es5 transpilation level issue

from vuex-module-decorators.

championswimmer avatar championswimmer commented on May 13, 2024

v0.7.1 really totally fixes this. I finally figured out what the issue was

from vuex-module-decorators.

championswimmer avatar championswimmer commented on May 13, 2024

from vuex-module-decorators.

ruifigueira avatar ruifigueira commented on May 13, 2024

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.

championswimmer avatar championswimmer commented on May 13, 2024

are you using Typescript only or Typescript + Babel setup ?

from vuex-module-decorators.

ruifigueira avatar ruifigueira commented on May 13, 2024

Typescript + Babel (I used vue-cli for the setup).

from vuex-module-decorators.

mastrayer avatar mastrayer commented on May 13, 2024

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.

aceven24 avatar aceven24 commented on May 13, 2024

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.

aceven24 avatar aceven24 commented on May 13, 2024

And FYI 0.8.0 works, no issues.

from vuex-module-decorators.

KleinMaximus avatar KleinMaximus commented on May 13, 2024

transpileDependencies: ['vuex-module-decorators'] works for me

from vuex-module-decorators.

shishkinilya avatar shishkinilya commented on May 13, 2024

@championswimmer what i have to do if I dont use vue-cli and my tsconfig target is es5?

from vuex-module-decorators.

championswimmer avatar championswimmer commented on May 13, 2024

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.

aceven24 avatar aceven24 commented on May 13, 2024

@KleinMaximus with .90?

@championswimmer this is all I have in my vue.config.js

module.exports = {
transpileDependencies: ['vuex-module-decorators']
}

from vuex-module-decorators.

Armour avatar Armour commented on May 13, 2024

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.

Dids avatar Dids commented on May 13, 2024

@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.

championswimmer avatar championswimmer commented on May 13, 2024

Everyone please vote here #68

Need your opinions

from vuex-module-decorators.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.