The dependency should be added to the project's `package.json` dependencies.
## 2. Identify the Web Application
- Verify the Web Application exists in `force-app/main/default/webapplications/<web-app-name>/`.
- Confirm the Web Application has a `lightningOut` target in its `webapplication-meta.xml` file.
- If no Web Application exists, the user must create one first using the Web Apps template system.
## 3. Generate the Micro Frontend component
Run the `generate-micro-frontend` command with the Web Application name from the root of an SFDX project:
```bash
npx generate-micro-frontend <web-app-name>
```
This creates:
- A custom wrapper LWC component in `force-app/main/default/lwc/<webAppName>/`. This is the "Micro Frontend component".
- The static `microFrontendShell` component that handles iframe communication.
Notes:
- The command may be added to the project's `package.json` scripts for convenience.
- The Micro Frontend component uses the Web Application name (e.g. `my-web-app/`) in camelCase for its folder and file names (e.g. `myWebApp/myWebApp.js`, `myWebApp/myWebApp.html`).
## 4. Customize the Micro Frontend component metadata
Edit the `<webAppName>.js-meta.xml` file to:
- Set appropriate `targets` (e.g. `lightning__HomePage`, `lightning__AppPage`, `lightning__RecordPage`, `lightningCommunity__Page`)
- Add `targetConfigs` for page-specific properties
- Optionally update the `masterLabel` and `description`