防止 create-react-app TS 编译缩小的库

Prevent create-react-app TS from compiling minified libraries

在我们的项目中,我们有一些类似黑盒子的缩小库。它们真的很老,而且是专有软件(所以没有打字或 GitHub 回购或任何东西)。

我们正在探索使用 Typescript 迁移到 create-react-app,但我们还没有找到在 starting/compiling 项目时忽略这些文件的方法。

我们得到的错误是:

Failed to compile.

./src/minified-files/some-lib.min.js
  Line 11:57:      'define' is not defined                                                no-undef
  Line 11:69:      'define' is not defined                                                no-undef
  Line 11:7435:    Expected an assignment or function call and instead saw an expression  no-unused-expressions

这是我们尝试过的方法:

  1. "exclude": [ "./src/minified-files/*" ] 添加到 tsconfig.json
  2. src/minified-files/* 添加到 .eslintignore

到目前为止没有任何效果,有什么想法吗?

似乎 .eslintignore 是解决方案,但我不得不使用 EXTEND_ESLINT=true,因为我使用的是 CRA