Git Product home page Git Product logo

Comments (4)

MilanKovacic avatar MilanKovacic commented on May 27, 2024

Hi,

  1. There are several ways to describe the layout, depending on application complexity. You can define a layout in the layout file, construct the layout programmatically, or not even use a layout and use lower level constructs such as parcels.
  2. Microfrontend does not need to know anything about how/where it is mounted, as that would create coupling
  3. You can use one root-config
  4. Microfrontends by default do not function in standalone mode (as they are more akin to library, rather than a web applcation). However, this can be achieved by using a "transparent" root-config. For example, when user accesses example.com/standalone/my-microfrontend, you can detect the route and display only that single microfrontend inside the root-config. I've typically used parcels for this.

from single-spa.

doelgonzo avatar doelgonzo commented on May 27, 2024

Thanks for the answer! For item 3, do you mean to use the same root-config and deploy individually to each subdomain? Maybe have an HTML file entry point different for each? How would we distinguish this in the microfrontends-layout.html? Any direction here is welcome. The doc doesn't seem to cover the case of subdomains, and I'm hoping it won't require heavy lift to handle this kind of scenario.

from single-spa.

MilanKovacic avatar MilanKovacic commented on May 27, 2024

It depends on the complexity of your application.
single-spa-layout offers several options:

  1. A static layout definition
  2. Programmatically constructed layout (from HTML string, file, etc)

With the second option, you can maintain different layout files — each for one subdomain; you can have a single layout that you programmatically adapt after detecting the subdomain, etc.

Your choices mainly depend on how complex, and different layouts on each subdomain are.

single-spa-layout offers a lot of customization, but if that is not enough, you can build your own stitching layer and render applications / parcels manually, without having a predefined layout. This is useful in cases where you have very complex views — for example, a view where user can customize a grid of microfrontends (think Grafana, and similar).

If you can add more information about what differs between subdomain, I would be able to explain it in more detail.

from single-spa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.