johnsoncodehk / vue-tsc

vue-tsc --noEmit && vite build
https://www.npmjs.com/package/vue-tsc
MIT License
241 stars 6 forks source link

How to ignore node_modules package checks ? #52

Closed you227 closed 3 years ago

you227 commented 3 years ago
vue-tsc --noEmit && vite build --mode production

message

> build
> vue-tsc --noEmit && vite build --mode production

node_modules/element-plus/lib/el-cascader-panel/index.d.ts:5:15 - error TS2307: Cannot find module './src/types' or its corresponding type declarations.

5 export * from './src/types';
                ~~~~~~~~~~~~~

node_modules/element-plus/lib/el-cascader-panel/src/config.d.ts:2:93 - error TS2307: Cannot find module './types' or its corresponding type declarations.

2 import { CascaderValue, CascaderOption, CascaderConfig, CascaderProps, ExpandTrigger } from './types';
                                                                                              ~~~~~~~~~

node_modules/element-plus/lib/el-cascader-panel/src/index.vue.d.ts:2:18 - error TS2307: Cannot find module './node' or its corresponding type declarations.

2 import Node from './node';
Shinigami92 commented 3 years ago

Try adding "exclude": ["node_modules"] in your tsconfig.json

you227 commented 3 years ago

Added configuration but it didn't work

vue-tsc version 0.2.2

tsconfig.json

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "node",
    "strict": true,
    "jsx": "preserve",
    "sourceMap": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "lib": ["esnext", "dom"],
    "paths": {
    // 根据别名配置相关路径
      "@/*": ["./src/*"]
    },
  },
  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
  "exclude": ["node_modules"],
}
johnsoncodehk commented 3 years ago

Please config skipLibCheck in tsconfig or --skipLibCheck in cli. See https://github.com/johnsoncodehk/vue-tsc/issues/16#issuecomment-818426244.

you227 commented 3 years ago

@johnsoncodehk Added the vue-tsc --noEmit --skipLibCheck command, the *.d.ts file was ignored, but the *.ts file was still scanned

--skipLibCheck Skip type checking of declaration files.

vue-tsc --noEmit --skipLibCheck

output

> build
> vue-tsc --noEmit --skipLibCheck && vite build --mode production

node_modules/element-plus/lib/utils/types.ts:24:26 - error TS2304: Cannot find name 'Nullable'.

24 export type RefElement = Nullable<HTMLElement>
johnsoncodehk commented 3 years ago

@you227 Maybe node_modules/element-plus/lib/utils/types.ts has references in src so it can't be ignore.