Skip to main content

Add Child App without CLI

  1. Create new repo

  2. Init package-manager

  3. Add necessarily package for child app

      yarn add --dev @tramvai/cli
    yarn add @tramvai/child-app-core
  4. Create new file tramvai.json in the root with following content

    {
    "$schema": "./node_modules/@tramvai/cli/schema.json",
    "projects": {
    "[name]": {
    "name": "[name]",
    "root": "src",
    "type": "child-app"
    }
    }
    }
  5. Add scripts to package.json for run child in dev and prod mode:

    {
    "scripts": {
    "start": "tramvai start [name]",
    "build": "tramvai build [name]"
    }
    }
  6. Implement your React-component wrapper (for example in ./src/component.tsx)

  7. Add new file ./src/entry.ts for you app with following content:

    import { createChildApp } from '@tramvai/child-app-core';
    import { ChildAppComponent } from './component';

    // eslint-disable-next-line import/no-default-export
    export default createChildApp({
    name: '[name]',
    modules: [],
    render: ChildAppComponent,
    });