bbonch / vue3-recaptcha2

Vue v3 component for Google reCAPTCHA v2
40 stars 9 forks source link

The 'vue3-recaptcha2' library may need to update its package.json or typings? #13

Open seriiserii825 opened 1 year ago

seriiserii825 commented 1 year ago

Hi, i have an problem with typescript in vue3 composition api for build.

There are types at '/home/serii/Sites/vue/vue-silcompa/node_modules/vue3-recaptcha2/dist_types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'vue3-recaptcha2' library may need to update its package.json or typings.

I fixed directly in node_modules in vue3-recaptcha2/package.json, replaced this code:

  "exports": {
    ".": {
      "import": {
        "types": "./dist_types/index.d.ts",
        "node": "./index.mjs",
        "default": "./dist/vue3-recaptcha2.es.js"
      },
      "require": "./dist/vue3-recaptcha2.umd.js"
    }
  },

Can you update the package?

isarhoo commented 1 year ago

I have the same problem

markhermano commented 8 months ago

While waiting for the update, a temporary fix is to create your declaration file and include it in your tsconfig.json.

types/vue3-recaptcha2.d.ts

declare module 'vue3-recaptcha2'

tsconfig.json

{
  "compilerOptions":  {
    "include": [ "types/**/*.d.ts" ],
  }
}