Javascript 如何使用重新连接了TypeScript的react应用程序?

Javascript 如何使用重新连接了TypeScript的react应用程序?,javascript,reactjs,typescript,webpack,create-react-app,Javascript,Reactjs,Typescript,Webpack,Create React App,下面的StackOverflow回答告诉我如何使用react app rewired从src文件夹外部导入JavaScript文件,而不弹出应用程序: 但是,当将其用于src文件夹外的Typescript文件时(即,import*from'../../myfile.ts'),我会遇到以下错误: Module not found: Can't resolve 'ts-loader' in '...\myapp' 因此,我安装了ts-loader(纱线添加ts-loader),但现在我得到了 E

下面的StackOverflow回答告诉我如何使用react app rewired从
src
文件夹外部导入JavaScript文件,而不弹出应用程序:

但是,当将其用于
src
文件夹外的Typescript文件时(即,
import*from'../../myfile.ts'
),我会遇到以下错误:

Module not found: Can't resolve 'ts-loader' in '...\myapp'
因此,我安装了
ts-loader
纱线添加ts-loader
),但现在我得到了

Error: TypeScript emitted no output for ...\myapp\src\index.tsx
tsconfig.json
中的
noEmit
设置为
true

有什么想法吗

编辑:这是我的
tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react"
  },
  "include": [
    "src"
  ]
}


请出示您的tsconfig。我认为您应该将此文件添加到编译过程中,方法是将其添加到
include
files
property@nickbullock请参见编辑tsconfig。奇怪的是,错误消息中的文件是项目内部的文件,即
src
文件夹中的文件。它不是外部文件。请尝试以下步骤:删除
noEmit:true
并将“include”更改为
“include”:[“src/****”]
@nickbullock显然,
create-react-app
在删除时立即将
noEmit:true
放回。