Can I modify a build/test environments?


#1

Hi,

I’ve started to work with Bit, and I’m able to set up a compiler for my components, but to build my components properly I need to add additional plugins to the .babelrc file in the compiler (
https://bitsrc.io/bit/envs/compilers/babel).
How do I do that?


Compatible tools
#2

Well, what I found that worked for me is to handle a build env just like any other component… Basically, import it and export your own version, just like you can modify a component and export it to another scope.

This was my flow:

  1. Create a new directory and an empty workspace in it
  2. Import the environment you want to modify (but without the --compiler/tester flag)
  3. Open and modify the .babelrc file of the component
  4. Tag and export the new version of the component to your own scope

Now you have your own compiler with a modified set of plugins.
The next step is to head back to your project, and modify the bit.json file to point to the new compiler, run bit status to see that all components are now modified (due to the modified compiler). Tag and export a new version, with the new compiler.

Hope this helps!


#3

Ok, thanks, ill give it a try.
When I come to think of it, can I pass my own config to a compiler, rather than modify and create my own?


#4

hi @mamugev , you are right… it’s a much more developer friendly approach.
This is why we have started to implement this exact feature.

It’s still in alpha stage, not stable enough, but I think that in the next few weeks it’ll be ready.


#5

oh, ammm… will these new APIs require me to modify any of my components?


#6

No worries, we’re making sure to be fully backward compatible with this feature, as many teams have their own compilers, and we do not want to break their workflow.


#7

Hi @itay. Is this already done or still work in progress?