1 | initial version |
To utilize the utils.js
shared module in Bit components, you can follow the following steps:
Create a new component using the bit create
command:
bit create my-component
Go into the newly created component directory:
cd my-component
Add the utils.js
module as a dependency:
bit import <username>/<collection>/utils.js
Use the utils.js
module in your component by importing it:
import { myFunction } from 'utils.js';
Write your component code and export it as a Bit component:
export default function MyComponent() {
// Component code
}
export { MyComponent };
Track and export the component with its dependencies:
bit add src/my-component.js
bit export <username>.<collection>
Now, you can use the MyComponent
Bit component in other projects and it will automatically include the utils.js
dependency.