The RemotePage Component

When deciding what level of integration you would like to have between your external SPA and AEM, it is often clear that you need to be able to view and edit the SPA within AEM. The RemotePage Component is a custom page component just for this purpose.

Overview

The RemotePage component fetches all the necessary assets from the application’s generated asset-manifest.json and uses this for rendering the SPA within AEM.

  • The RemotePage allows you to inject the scripts and stylesheets of a SPA in the body of an AEM Page component.
  • The Virtual Frontend Components allows to mark sections as editable in AEM SPA Editor.
  • Together, a SPA hosted on a different domain can be made editable in AEM.

See the article Editing an External SPA within AEM for more details on editable, external SPAs in AEM.

Requirements

  • Enable CORS in development

  • Configure remote URL in Page Properties

  • Render the SPA in AEM

  • The web application must use a bundler asset manifest like one of the following, and expose an asset-manifest.json file at the domain root that lists in an entrypoints property all CSS and JS files that are to be loaded:

    • https://github.com/shellscape/webpack-manifest-plugin
    • https://github.com/webdeveric/webpack-assets-manifest
    • https://github.com/mugi-uno/parcel-plugin-bundle-manifest

    Entrypoints

  • The application must be able to initialize in a <div id="root"></div> underneath the body element. If a different markup is expected for the app to instantiate, then this must be adjusted accordingly in the HTL scripts of the proxy component that has a sling:resourceSuperType="spa-project-core/components/remotepage.

Limitations

  • The current implementation of the RemotePage component supports remote React applications only.
  • Internal CSS defined in the application’s root HTML file as well as inline CSS on the root DOM node will not be available when doing remote rendering in AEM.

Technical Details

Like the rest of the AEM SPA project, the RemotePage Component is open source. For the full technical details of the RemotePage Component, please see the GitHub repository.

On this page

Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now