teambit / bit.envs

DEPRECATED - Bit compilers and testers were moved to https://github.com/teambit/envs
https://bit.dev/bit/envs
Other
23 stars 9 forks source link

React TypeScript compiler #59

Closed JoshK2 closed 4 years ago

JoshK2 commented 4 years ago

I have a project written in react and typescript, and the compiler is not working. Only if I go back and install compiler version 3.0.1 is working, this version is the last before updating the compiler to work with the typescript base compiler and with the capsule.

STR:

This is the compiler I used and it's working: https://bit.dev/bit/envs/compilers/react-typescript/~dependencies?version=3.0.1

This is the compiler I used and it's NOT working: https://bit.dev/bit/envs/compilers/react-typescript/~dependencies?version=3.0.21

qballer commented 4 years ago

Hi @JoshK2 there are several issues here:

  1. configuration, i've used the following. Changes:
    • When there is no typescript file tsc will fail because he thinks you miss configured it. I've removed those components compiler (assests/styles). ** @types/jest is global and can't be inferred from the code so it must be added.
      "bit": {
      "overrides": {
      "*": {
      "devDependencies": {
        "@types/jest":"+"
      }
      },
      "assets/*": {
      "env": {
        "compiler": "-"
      }
      },
      "styles/*": {
      "env": {
        "compiler": "-"
      }
      }
      },
      "env": {
      "compiler": "bit.envs/compilers/typescript@3.0.26"
      },
      "componentsDefaultDirectory": "components/{name}",
      "packageManager": "npm"
      }
  2. Bit doesn't recognise the @types/react devDependency. it should as it is import and the @types/react counterpart exists. (cc: @GiladShoham)
  3. No proper error is seen by the user - this I'm going to fix this in the compiler.

This is less then an optimal experience. We need to improve on that.

GiladShoham commented 4 years ago

the @types resolved - see https://github.com/teambit/bit/issues/1990 part of dev.5

qballer commented 4 years ago

You can also now get errors to the console from typescript. Asset only components are supported 3.0.28