最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

vue.js - Typescript tsconfig ignored - Stack Overflow

programmeradmin1浏览0评论

I am getting a typescript error that shouldn't happen because the tsconfig should prevent it from being compiled. In my tsconfig file I have skipLibCheck set to true. I have the node_modules folder in the excludes section, as well as other variations of it with wildcards as well. The errors I am getting are build errors in the ts file.

This was done after the version of vue was upgraded from 2 to 3. And the ts file is under the node_modules/@vue folder, so there might be a connection. We do have three different tsconfig files, one at the root, and the eother two are in separate sections that require separate settings.

This project is massive and too large to upload a working copy to replicate this issue.

Is the issue purely typescript, or is it vue related?

These are the things I have tried. But I still get the errors as if the tsconfig is being ignored.

  1. I have tried variations in the tsconfig of the node_modules folder.

  2. I have tried adding an entry in the tsconfig with the full path to the file.

  3. Uninstalling and re-installing the latest version of typescript

  4. Setting the target to ES6 and ESNext

  5. Deleting the node_modules folder and reinstalling everything.

  6. Set compileOnSave to false

I am expecting the project to build successfully since the ts files should not be compiled at all.

Root tsconfig:

{
  "compilerOptions": {
    "target": "es5",
    "inlineSourceMap": true,
    "skipLibCheck": true,
    "types": [
      "node",
      "jquery"
    ]
  },
  "exclude": [
    "ClientApp/**/*",
    "ClientApp/**/*.js",
    "ClientApp/**/*.vue",
    "ClientAppPublic/**/*",
    "ClientAppPublic/**/*.js",
    "ClientAppPublic/**/*.vue",
    "Scripts/Kendo/**",
    "Scripts/ckeditor/**",
    "Scripts/core-js/**",
    "Scripts/moment/**",
    "Scripts/jquery-*",
    "Scripts/jquery.*.js",
    "Scripts/knockout-*",
    "Scripts/typings/**",
    "**/publish.ts",
    "node_modules",
    "./node_modules",
    "./node_modules/*",
    "./node_modules/**",
    "./node_modules/@types/node/index.d.ts",
    "./XULRunner21_0/**",
    "./XULRunner38_0/**"
  ]
}

tsconfig 2:

{
  "compileOnSave": false,
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "maxNodeModuleJsDepth": 2,
    "module": "ESNext",
    "moduleResolution": "Node",
    "noEmit": true,
    "target": "ESNext",
    "skipLibCheck": true,
    "baseUrl": ".",
    "lib": [
      "ESNext",
      "DOM",
      "DOM.Iterable",
      "ScriptHost",      
      "WebWorker.ImportScripts"
    ],
    "paths": {
      "@/*": [ "./*" ],
      "modules": [ "../node_modules/*" ],
      "vue_components/*": [ "./components/*" ],
      "vue_views/*": [ "./views/*" ],
      "directives/*": [ "./directives/*" ],
      "images/*": [ "../Content/documatix/Images/*" ],
      "legacyutil/*": [ "../App_Scripts/*" ],
      "scss/*": [ "../Content/documatix/*" ]
    },
    "removeComments": true,
    "sourceMap": true,
    "typeRoots": [
      "../node_modules/@types",
      "../node_modules/vuetify/types"
    ],
    "types": [
      "node",
      "jquery",
      "vuetify"
    ]

  },
  "exclude": [
    "node_modules"
  ]

}

tsconfig 3:

{
  "compileOnSave": false,
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "maxNodeModuleJsDepth": 2,
    "module": "ESNext",
    "moduleResolution": "Node",
    "noEmit": true,
    "target": "ESNext",
    "skipLibCheck": true,
    "baseUrl": ".",
    "lib": [
      "ESNext",
      "DOM",
      "DOM.Iterable",
      "ScriptHost",      
      "WebWorker.ImportScripts"
    ],
    "paths": {
      "@/*": [ "./*" ],
      "modules": [ "../node_modules/*" ],
      "vue_components/*": [ "./components/*" ],
      "vue_views/*": [ "./views/*" ],
      "directives/*": [ "./directives/*" ],
      "images/*": [ "../Content/documatix/Images/*" ],
      "legacyutil/*": [ "../App_Scripts/*" ],
      "scss/*": [ "../Content/documatix/*" ]
    },
    "removeComments": true,
    "sourceMap": true,
    "typeRoots": [
      "../node_modules/@types",
      "../node_modules/vuetify/types"
    ],
    "types": [
      "node",
      "jquery",
      "vuetify"
    ]

  },
  "exclude": [
    "node_modules"
  ]

}

I am getting a typescript error that shouldn't happen because the tsconfig should prevent it from being compiled. In my tsconfig file I have skipLibCheck set to true. I have the node_modules folder in the excludes section, as well as other variations of it with wildcards as well. The errors I am getting are build errors in the ts file.

This was done after the version of vue was upgraded from 2 to 3. And the ts file is under the node_modules/@vue folder, so there might be a connection. We do have three different tsconfig files, one at the root, and the eother two are in separate sections that require separate settings.

This project is massive and too large to upload a working copy to replicate this issue.

Is the issue purely typescript, or is it vue related?

These are the things I have tried. But I still get the errors as if the tsconfig is being ignored.

  1. I have tried variations in the tsconfig of the node_modules folder.

  2. I have tried adding an entry in the tsconfig with the full path to the file.

  3. Uninstalling and re-installing the latest version of typescript

  4. Setting the target to ES6 and ESNext

  5. Deleting the node_modules folder and reinstalling everything.

  6. Set compileOnSave to false

I am expecting the project to build successfully since the ts files should not be compiled at all.

Root tsconfig:

{
  "compilerOptions": {
    "target": "es5",
    "inlineSourceMap": true,
    "skipLibCheck": true,
    "types": [
      "node",
      "jquery"
    ]
  },
  "exclude": [
    "ClientApp/**/*",
    "ClientApp/**/*.js",
    "ClientApp/**/*.vue",
    "ClientAppPublic/**/*",
    "ClientAppPublic/**/*.js",
    "ClientAppPublic/**/*.vue",
    "Scripts/Kendo/**",
    "Scripts/ckeditor/**",
    "Scripts/core-js/**",
    "Scripts/moment/**",
    "Scripts/jquery-*",
    "Scripts/jquery.*.js",
    "Scripts/knockout-*",
    "Scripts/typings/**",
    "**/publish.ts",
    "node_modules",
    "./node_modules",
    "./node_modules/*",
    "./node_modules/**",
    "./node_modules/@types/node/index.d.ts",
    "./XULRunner21_0/**",
    "./XULRunner38_0/**"
  ]
}

tsconfig 2:

{
  "compileOnSave": false,
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "maxNodeModuleJsDepth": 2,
    "module": "ESNext",
    "moduleResolution": "Node",
    "noEmit": true,
    "target": "ESNext",
    "skipLibCheck": true,
    "baseUrl": ".",
    "lib": [
      "ESNext",
      "DOM",
      "DOM.Iterable",
      "ScriptHost",      
      "WebWorker.ImportScripts"
    ],
    "paths": {
      "@/*": [ "./*" ],
      "modules": [ "../node_modules/*" ],
      "vue_components/*": [ "./components/*" ],
      "vue_views/*": [ "./views/*" ],
      "directives/*": [ "./directives/*" ],
      "images/*": [ "../Content/documatix/Images/*" ],
      "legacyutil/*": [ "../App_Scripts/*" ],
      "scss/*": [ "../Content/documatix/*" ]
    },
    "removeComments": true,
    "sourceMap": true,
    "typeRoots": [
      "../node_modules/@types",
      "../node_modules/vuetify/types"
    ],
    "types": [
      "node",
      "jquery",
      "vuetify"
    ]

  },
  "exclude": [
    "node_modules"
  ]

}

tsconfig 3:

{
  "compileOnSave": false,
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "maxNodeModuleJsDepth": 2,
    "module": "ESNext",
    "moduleResolution": "Node",
    "noEmit": true,
    "target": "ESNext",
    "skipLibCheck": true,
    "baseUrl": ".",
    "lib": [
      "ESNext",
      "DOM",
      "DOM.Iterable",
      "ScriptHost",      
      "WebWorker.ImportScripts"
    ],
    "paths": {
      "@/*": [ "./*" ],
      "modules": [ "../node_modules/*" ],
      "vue_components/*": [ "./components/*" ],
      "vue_views/*": [ "./views/*" ],
      "directives/*": [ "./directives/*" ],
      "images/*": [ "../Content/documatix/Images/*" ],
      "legacyutil/*": [ "../App_Scripts/*" ],
      "scss/*": [ "../Content/documatix/*" ]
    },
    "removeComments": true,
    "sourceMap": true,
    "typeRoots": [
      "../node_modules/@types",
      "../node_modules/vuetify/types"
    ],
    "types": [
      "node",
      "jquery",
      "vuetify"
    ]

  },
  "exclude": [
    "node_modules"
  ]

}
Share Improve this question asked Mar 5 at 20:35 SChristiansenSChristiansen 12 bronze badges 4
  • Please, check stackoverflow/help/how-to-ask . It's unknown what your case is and how it could be solved. "a typescript error" - which error and which process does cause it? How exactly is ts used? – Estus Flask Commented Mar 6 at 7:56
  • I think the issue is that it should be ignoring the typescript files. The excludes section of the tsconfig should ignore the file altogether. So I posted the tsconfig files in hopes something was wrong with them that I couldn't see. – SChristiansen Commented Mar 6 at 14:38
  • I see no problems in tsconfig itself. There may be no need to publish the whole copy but there's still an need for stackoverflow/help/mcve . This is likely specific to your setup, which is unknown. This could be anything, including bugs in the toolchain – Estus Flask Commented Mar 6 at 15:49
  • I found a solution. I changed the TypeScriptCompileBlocked setting in the project to true. <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> – SChristiansen Commented Mar 7 at 17:16
Add a comment  | 

1 Answer 1

Reset to default 0

I found a solution. I changed the TypeScriptCompileBlocked setting in the project to true.

<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
发布评论

评论列表(0)

  1. 暂无评论