相关疑难解决方法(0)

如何强制tsc忽略node_modules文件夹?

我正在使用tsc构建任务.不幸的是,我总是从节点模块文件夹中得到相同的错误

Executing task: .\node_modules\.bin\tsc.cmd --watch -p .\tsconfig.json <
node_modules/@types/node/index.d.ts(6208,55): error TS2304: Cannot find name 'Map'.
node_modules/@types/node/index.d.ts(6215,55): error TS2304: Cannot find name 'Set'.
node_modules/@types/node/index.d.ts(6219,64): error TS2304: Cannot find name 'Symbol'.
node_modules/@types/node/index.d.ts(6225,59): error TS2304: Cannot find name 'WeakMap'.
node_modules/@types/node/index.d.ts(6226,59): error TS2304: Cannot find name 'WeakSet'.
10:13:18 - Compilation complete. Watching for file changes.
Run Code Online (Sandbox Code Playgroud)

我已经将目录添加到tsconfig.json中的ignore

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "sourceMap": true,
    "strict": false,
    "noImplicitAny": false,
    "strictPropertyInitialization": false,
    "esModuleInterop": true,
  },
  "include": [
    "src/*"
  ],
  "exclude": [
    "node_modules",
    "./node_modules",
    "./node_modules/*",
    "./node_modules/@types/node/index.d.ts", …
Run Code Online (Sandbox Code Playgroud)

node.js tsc tsconfig

7
推荐指数
8
解决办法
4652
查看次数

标签 统计

node.js ×1

tsc ×1

tsconfig ×1