1amageek / ballcap.ts

Cloud Firestore support library for admin. 🧢
107 stars 13 forks source link

[Vue warn]: Error in v-on handler: "TypeError: Class constructor Doc cannot be invoked without 'new'" #4

Closed kawamataryo closed 5 years ago

kawamataryo commented 5 years ago

Hi. Thank you for creating a very useful library. I want to use this library, but I am troubled with errors.

Description

Error occurs when writing document.

[Vue warn]: Error in v-on handler: "TypeError: Class constructor Doc cannot be invoked without 'new'"

This error occurred here. https://github.com/kawamataryo/try-ballcap/blob/master/src/components/tryBallcapp.vue#L60

Screen shot

スクリーンショット 2019-07-07 7 12 56

Environment

Vue CLI 3 Project.

My repository is here. https://github.com/kawamataryo/try-ballcap

1amageek commented 5 years ago

@kawamataryo

Thank you for your message. This error is caused by babel.

Remove babel from package.json and run npm install -d.

{
  "name": "try-ballcap",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "@1amageek/ballcap": "^0.4.1",
    "core-js": "^2.6.5",
    "firebase": "^6.2.4",
    "vue": "^2.6.10",
    "vue-class-component": "^7.0.2",
    "vue-property-decorator": "^8.1.0"
  },
  "devDependencies": {
    "@vue/cli-plugin-typescript": "^3.9.0",
    "@vue/cli-service": "^3.9.0",
    "@vue/eslint-config-typescript": "^4.0.0",
    "typescript": "^3.4.3",
    "vue-template-compiler": "^2.6.10"
  }
}
kawamataryo commented 5 years ago

@1amageek

Thank you for your prompt reply !! My problem was resolved.

May I ask additional questions? The same problem occurs When the target of tsconfig.json is set to es5. (Does not occur when "esnext" or "es2015".)

{
  "compilerOptions": {
    "target": "es5", 
    ...
}

Does this library not support transpiling es5 ?

1amageek commented 5 years ago

@kawamataryo Please use es6

kawamataryo commented 5 years ago

OK. Thank you.