【问题标题】:Prevent create-react-app TS from compiling minified libraries防止 create-react-app TS 编译缩小的库
【发布时间】:2020-09-09 22:54:59
【问题描述】:

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

我们正在探索使用 Typescript 迁移到 create-react-app,但我们还没有找到一种方法让它在启动/编译项目时忽略这些文件。

我们得到的错误是:

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

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

【问题讨论】:

    标签: typescript create-react-app eslint


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2020-07-09
      • 1970-01-01
      • 1970-01-01
      • 2020-06-11
      • 2021-03-06
      • 1970-01-01
      • 2018-11-26
      • 2021-10-11
      • 2018-08-13
      相关资源
      最近更新 更多