An app is a component that can be served, built and deployed. Naturally, apps have dependencies (components and packages) but no dependents.
For example, the todomvc/app
component is an app. It uses todomvc/header
and todomvc/footer
, two standard Bit components, as a dependencies:
Run the following to list all available apps in your workspace:
The output lists the IDs of the available app components and their corresponding app names:
│ id │ name │
├──────────────────────────┼──────────────┤
│ learnbit-vue.todomvc/app │ todomvc-app │
└──────────────────────────┴──────────────┘
Run the following to run an app locally, independent of Bit's dev server:
The output is similar the following (open the listed path and port in your browser, to explore your app):
Run the following to create an app using your env's component generator:
The output displays the ID of the generated app (component):
my-org.my-scope/apps/todo
location: my-scope/apps/my-vue-app
env: bitdev.vue/vue-env (set by template)
The generated app component includes an app plugin file, my-app.vue-app.cjs
, with a file extension that is detected by its corresponding application-type - in this case, the Vue app-type. Use a different plugin file to switch from Bit's official Vue app-type, to a different app-type.
This will affect how your app is being served, built and deployed.
Note that the app plugin file
my-app.vue-app.cjs
is not in ES Module but CommonJS format since this file need to be run directly in Node runtime.
Run the following using the app's component ID to make this app loadable by your workspace:
To define an existing component as an app, add to its directory an app plugin file.
Note that the specific file extension of a plugin file determines its application type.
For example, the following .vue-app.cjs
file extension is loaded by Bit's official Vue application type.
// my-app.vue-app.cjs module.exports = { name: 'my-app', /* provide your bundler with an app entry file */ entry: [require.resolve('./my-app.app-root')], };
To make this app loadable by your workspace, run the following:
Search bit.cloud for Vue apps. Fork app components to get started quicker, with apps that already have much of the setup you need.
For example, run the following to fork the TodoMVC app to your workspace:
Run the following to make the forked app loadable by your workspace: