Search code examples
typescriptcreate-react-appeslint

Prevent create-react-app TS from compiling minified libraries


In our project we have some minified libraries that are sort of a black box. They are really old and they're proprietary software (so there's no typing or GitHub repo or anything).

We're exploring moving to create-react-app with Typescript, but we haven't found a way for it to ignore this files when starting/compiling the project.

The errors we're getting are:

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

Here's what we've tried:

  1. add "exclude": [ "./src/minified-files/*" ] to tsconfig.json
  2. add src/minified-files/* to .eslintignore

Nothing has worked so far, any ideas?


Solution

  • It seems like .eslintignore is the solution, however I had to use EXTEND_ESLINT=true, since I'm using CRA