GithubHelp home page GithubHelp logo

Confusion over build() function about bit HOT 4 CLOSED

kamontat avatar kamontat commented on May 26, 2024
Confusion over build() function

from bit.

Comments (4)

kamontat avatar kamontat commented on May 26, 2024 1

@benjgil When will bit-app build() run?
I try to run bit build --include-tag but only bit-env build() was run (indicated by no log produce when run)

from bit.

benjgil avatar benjgil commented on May 26, 2024

Great question - it's probably based on a slight confusion about what a bit-app is, so i'll try to quickly clear up.

A bit-app component is just another standalone component, shareable and must itself have an env which will compile it, test it, package it.
It's not an env, which is essentially just a component for managing other components.

But while all other components are deployed by creating a version of them that will be consumed in an eventual application, an app component needs to be fully production ready and served to a CDN.
So in addition to the regular build tasks an env runs on components (compilation, testing, creating examples and docs, packaging etc), an app component needs some extra build actions applied to it - in the main, creating the production bundle.

So the build() function of an env contains tasks involved in the creation of a deployable version of the component (plus some bit features such as docs, component previews, etc), while on top of the env's build, the app component's build() handles the extra production bundling that the application requires in order to be deployed.

So they're named the same as they actually get invoked during the same build pipeline, but they each have their own responsibilities

from bit.

itaymendel avatar itaymendel commented on May 26, 2024

Hi, you can find information on running a build function for an app or through an env here - https://bit.dev/reference/build-pipeline/implement-build-task

in general, when in App, the build task is specific for the component, and when through an env, the build task will run for all components configured with that env.

both will run during the bit build command (and as such, as part of bit tag or snap).

you can always run this command to see all tasks for a component:

bit build --list-tasks <component-id>

from bit.

sbland avatar sbland commented on May 26, 2024

I had the same issue as @kamontat and couldnt get the app to run its build or deploy script if I ran bit build it only seems to run with bit tag -b or bit snap -b

from bit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.