Bit components can be built from any execution environment using Bit's isolated component environment.
In order to build a component, you need to have a compiler defined.
Defining a default compiler for your project
A compiler is defined per workspace. Once defined, building a component within that workspace will build the component using the defined compiler. In order to do that, just import the compiler:
$ bit import bit.envs/compilers/babel --compiler the following component environments were installed - email@example.com
You can now go take a look at the
env configuration in your bit.json and see your compiler over there.
Curated list of build environments on Bitsrc.io
Building your component
Once you have a defined compiler, you can build your component:
$ bit build foo/bar foo/bar dist/foo/bar.js dist/foo/bar.js.map
Building a component remotely
When staging or exporting components, Bit runs When staging or exporting components, Bit runs the components' extensions in an isolated component environment. So the
build process for the component will run outside of the context of the project. This will help to understand how separated the component truly is.
After exporting a component to a bitsrc.io-managed Scope, bitsrc.io will create an isolated container, where the component will be built in the remote Scope in an isolated component environment.
As the Scope owner or collaborator, you can enter the component page on bitsrc.io, and view the build log in the
Console Output tab.
Set dist target and entry
You can set your
dist target and entry by editing the bit.json.
Implementing a component compiler
You can implement your own custom compiler. See here for more details.