Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimize bundle size by splitting client and host-related code into separate secondary entry points #174

Closed
danielwiehl opened this issue Oct 7, 2022 · 0 comments
Projects
Milestone

Comments

@danielwiehl
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

To minimize bundle size we should split client and host-related code into separate secondary entry points. It is still the same module published to NPM but organized as secondary entry points.

Describe the solution you'd like

Secondary entry point for host-related code:
@scion/microfrontend-platform/host

Secondary entry point for client-related code:
@scion/microfrontend-platform/client

The host would then start the platform as follows:

import {MicrofrontendPlatform} from '@scion/microfrontend-platform/host';

MicrofrontendPlatform.startHost({...});

The client would then connect to the host as follows:

import {MicrofrontendPlatform} from '@scion/microfrontend-platform/client';

MicrofrontendPlatform.connectToHost('client');
@danielwiehl danielwiehl added this to Triage in SCION via automation Oct 7, 2022
@danielwiehl danielwiehl added this to the v1.0.0 milestone Nov 12, 2022
danielwiehl added a commit that referenced this issue Dec 20, 2022
closes #174

BREAKING CHANGE: reducing bundle size in client application introduced a breaking change for host and client applications. The communication protocol between host and client has not changed, i.e., host and clients can be updated independently to the new version.

To enable tree-shaking of the SCION Microfrontend Platform, the platform was split into three separate entry points:
- `MicrofrontendPlatformHost` to configure and start the platform in the host
- `MicrofrontendPlatformClient` to connect to the platform from a microfrontend
- `MicrofrontendPlatform` to react to platform lifecycle events and stop the platform

The size of the library bundled in a client application could be reduced by more than 50%, from 120 KB to 40 KB.

To migrate the host application:
  - start the platform via `MicrofrontendPlatformHost.start` instead of `MicrofrontendPlatform.startHost`
  - monitor startup progress via `MicrofrontendPlatformHost.startupProgress$` instead of `MicrofrontendPlatform.startupProgress$`

To migrate the client application:
  - connect to the host via `MicrofrontendPlatformClient.connect` method instead of `MicrofrontendPlatform.connectToHost`
  - test if connected to the host via `MicrofrontendPlatformClient.isConnected` method instead of `MicrofrontendPlatform.isConnectedToHost`
@danielwiehl danielwiehl mentioned this issue Dec 20, 2022
17 tasks
danielwiehl added a commit that referenced this issue Dec 20, 2022
closes #174

BREAKING CHANGE: reducing bundle size in client application introduced a breaking change for host and client applications. The communication protocol between host and client has not changed, i.e., host and clients can be updated independently to the new version.

To enable tree-shaking of the SCION Microfrontend Platform, the platform was split into three separate entry points:
- `MicrofrontendPlatformHost` to configure and start the platform in the host
- `MicrofrontendPlatformClient` to connect to the platform from a microfrontend
- `MicrofrontendPlatform` to react to platform lifecycle events and stop the platform

The size of the library bundled in a client application could be reduced by more than 50%, from 120 KB to 40 KB.

To migrate the host application:
  - start the platform via `MicrofrontendPlatformHost.start` instead of `MicrofrontendPlatform.startHost`
  - monitor startup progress via `MicrofrontendPlatformHost.startupProgress$` instead of `MicrofrontendPlatform.startupProgress$`

To migrate the client application:
  - connect to the host via `MicrofrontendPlatformClient.connect` method instead of `MicrofrontendPlatform.connectToHost`
  - test if connected to the host via `MicrofrontendPlatformClient.isConnected` method instead of `MicrofrontendPlatform.isConnectedToHost`
danielwiehl added a commit that referenced this issue Dec 20, 2022
closes #174

BREAKING CHANGE: reducing bundle size in client application introduced a breaking change for host and client applications. The communication protocol between host and client has not changed, i.e., host and clients can be updated independently to the new version.

To enable tree-shaking of the SCION Microfrontend Platform, the platform was split into three separate entry points:
- `MicrofrontendPlatformHost` to configure and start the platform in the host
- `MicrofrontendPlatformClient` to connect to the platform from a microfrontend
- `MicrofrontendPlatform` to react to platform lifecycle events and stop the platform

The size of the library bundled in a client application could be reduced by more than 50%, from 120 KB to 40 KB.

To migrate the host application:
  - start the platform via `MicrofrontendPlatformHost.start` instead of `MicrofrontendPlatform.startHost`
  - monitor startup progress via `MicrofrontendPlatformHost.startupProgress$` instead of `MicrofrontendPlatform.startupProgress$`

To migrate the client application:
  - connect to the host via `MicrofrontendPlatformClient.connect` method instead of `MicrofrontendPlatform.connectToHost`
  - test if connected to the host via `MicrofrontendPlatformClient.isConnected` method instead of `MicrofrontendPlatform.isConnectedToHost`
danielwiehl added a commit that referenced this issue Dec 21, 2022
closes #174

BREAKING CHANGE: reducing bundle size in client application introduced a breaking change for host and client applications. The communication protocol between host and client has not changed, i.e., host and clients can be updated independently to the new version.

To enable tree-shaking of the SCION Microfrontend Platform, the platform was split into three separate entry points:
- `MicrofrontendPlatformHost` to configure and start the platform in the host
- `MicrofrontendPlatformClient` to connect to the platform from a microfrontend
- `MicrofrontendPlatform` to react to platform lifecycle events and stop the platform

The size of the library bundled in a client application could be reduced by more than 50%, from 120 KB to 40 KB.

To migrate the host application:
  - start the platform via `MicrofrontendPlatformHost.start` instead of `MicrofrontendPlatform.startHost`
  - monitor startup progress via `MicrofrontendPlatformHost.startupProgress$` instead of `MicrofrontendPlatform.startupProgress$`

To migrate the client application:
  - connect to the host via `MicrofrontendPlatformClient.connect` method instead of `MicrofrontendPlatform.connectToHost`
  - test if connected to the host via `MicrofrontendPlatformClient.isConnected` method instead of `MicrofrontendPlatform.isConnectedToHost`
SCION automation moved this from Triage to Done Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
SCION
  
Done
Development

No branches or pull requests

1 participant