teambit / envs

Component development environments for the Bit community
https://bit.dev/bit/envs
Other
63 stars 9 forks source link

exception on undefined copyPolicy #66

Open KutnerUri opened 4 years ago

KutnerUri commented 4 years ago

Hey,

Using bit.envs/compilers/typescript@3.1.28, I am getting this error:

TypeError: Cannot read property 'disable' of undefined
    at [...]/.git/bit/components/compilers/typescript/bit.envs/3.1.28/dist/ts-compiler/src/compile.js:271:36

The error leads to this line:

copyPolicy = context.cc.dynamicConfig.copyPolicy;
if (copyPolicy.disable) {
  return [2, Promise.resolve([])];
}

I have a hunch this is expecting some compiler configuration, which is empty for compilers/typescript but built-in for compilers/typescript-react.

I am expecting the compiler to work out of the box, because I don't want any custom configurations.

Possible solutions:

  1. Prompt a more descriptive error message. (where is the problem? what do I need to do?)
  2. A 'guard' that will pre-validate the config, before executing the compiler.
  3. Assume config is all optional (ie. using recursive partial).

Specifications

bit version : 14.7.1 node version : v12.12.0 npm version : 6.13.4 yarn version : 1.19.1 platform : darwin