Multiple bit.envs for compiling

Hi! Is it possible to use multiple compilers? I’m exporting a React styled-component that’s Flow typed.

I’ve added the react compiler with bit import --compiler bit.envs/compilers/react and when I run bit build I see this error:

bit import --compiler --conf bit.envs/compilers/flow bit.envs/compilers/react  50 | 
  51 | export default theme;
> 52 | export type Theme = typeof theme;
     |             ^
  53 | 
SyntaxError: unknown: Unexpected token (52:12)

So then I add the Flow compiler with bit import --compiler bit.envs/compilers/flow and my new error is:

  19 |   switch (name) {
  20 |     case 'add':
> 21 |       return <Add {...props} />;
     |                   ^
  22 |     case 'ellipsis':
  23 |       return <Ellipsis {...props} />;
  24 |     case 'hamburger':
SyntaxError: unknown: Unexpected token, expected "," (21:18)

Which tells me I’m never running both envs and I’m wondering how to do that. Is this possible?

Hi, you can do that.

Use the overrides feature for it.

Here’s an example.
And here are the docs

Oh great! Thank you!

1 Like

@ saijoshofgilead Could you share the configuration you used to make it work?

Before I heard back here, I had made my own compiler that includes Flow and React and that seemed to solve my issue. https://bit.dev/area1/marshall-ui/compilers/react <- It says that’s Public, so hopefully you can take a look or even use it, if you’d like.