current position:Home>TS cannot find global variable for NPM package

TS cannot find global variable for NPM package

2022-06-24 09:38:36CSDN Q & A

The phenomenon and background of the problem

Environmental Science :vue3 vite ts

problem : The use of plug-in :unplugin-vue-define-options , Compiling is an error report : Cannot find name 'defineOptions'.

defineOptions The definition is in the overall situation :\node_modules\unplugin-vue-define-options\dist\index.d.ts

img

img

My solution ideas and tried methods

Should be unplugin-vue-define-options This plug-in has a global variable called :defineOptions, But in ts When compiling, I couldn't find , It's said to be revised tsconfig.json file , But I don't know how to modify it

Here's my tsconfig.json

{ 
      "compilerOptions": { 
        "target": "esnext",    "useDefineForClassFields": true,    "module": "esnext",    "moduleResolution": "node",    "strict": true,    "jsx": "preserve",    "sourceMap": true,    "resolveJsonModule": true,    "esModuleInterop": true,    "allowJs": true,    "lib": [      "esnext",      "dom"    ],    "skipLibCheck": true,    "paths": { 
          "packages/*": [        "./packages/*",      ]    }  },  "include": [    "*.ts",    "src/**/*.ts",    "src/**/*.d.ts",    "src/**/*.tsx",    "src/**/*.vue",    "packages/**/*.ts",    "packages/**/*.d.ts",    "packages/**/*.tsx",    "packages/**/*.vue"  ]}

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/175/202206171715321823.html

Random recommended