Bit components can be built from any execution environment using Bit’s isolated component environment. Build components after making changes from any environment and be project setup agnostic.
In order to build a component, you need to have a compiler defined.
Defining a default compiler for your project
$ bit import bit.envs/compilers/babel --compiler the following component environments were installed - firstname.lastname@example.org
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.