React-Scripts-TS在所有文件夹中寻找依赖项,并在构建上丢弃错误



i使用node.js Typescript和React Typescript构建FullStack应用程序。文件夹结构:

App
   -node_modules             //server part's dependencies
   -build                    //includes compiled server code
   -src
       -server
       -client
              -node_modules  //client part's dependencies
              tsconfig.json  //created by 'create-react-app'
              package.json   //created by 'create-react-app'
tsconfig.json
tslint.json
package.json                 // includes config for server compiling and running

所以,当我执行命令tsc && node build/www服务器启动时。

但是,如果我想用命令react-scripts-ts start构建React Bundle,我会得到不属于React项目的错误。例如:

Failed to compile.
~/projects/App/node_modules/@types/graphql/execution/execute.d.ts
(1,44): Cannot find module '../error'.

为什么反应式TS在非反应文件夹中寻找依赖项?

只需添加到客户端/tsconfig.json到compileroptions下一个规则: "skipLibCheck": true

最新更新