简体   繁体   English

如何解决文件的扩展名不受支持。 唯一支持的扩展名是“.ts”、“.tsx”、“.d.ts”、“.js”、“.jsx”

[英]How to solve File has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'

I am unable to solve this particular error:我无法解决此特定错误:

File 'D:/coreui-todo-app/node_modules/multiple-textbox/....' has unsupported extension.文件“D:/coreui-todo-app/node_modules/multiple-textbox/....”的扩展名不受支持。 The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx'.唯一支持的扩展名是“.ts”、“.tsx”、“.d.ts”、“.js”、“.jsx”。

The solution that I implemented is as follows.我实施的解决方案如下。

Entering the value of输入值

  "allowJs": true

in

"compilerOptions": {
    "importHelpers": true,
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowJs": true,
    "module": "esnext",
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "esnext",
      "dom"
    ]
  }

However, I am still facing the same issue.但是,我仍然面临同样的问题。

The screenshot attached:附上截图:

在此处输入图像描述


Updated screenshot as suggested by @Pointy to remove.spec.ts -按照@Pointy 的建议将屏幕截图更新为 remove.spec.ts -

在此处输入图像描述

tsconfig.json has an unsupported extension tsconfig.json 具有不受支持的扩展名

I solved it by adjusting my script.我通过调整脚本解决了这个问题。

tsc-watch --compiler typescript/bin/tsc

And removed the tsconfig.json from the command.并从命令中删除了 tsconfig.json。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM