Is there a way to have the client side script also auto loaded from the proxy/cluster services in the Ara Framework?

后端 未结 1 651
不知归路
不知归路 2021-01-28 17:42

First of all a great framework for SSR based MFEs . I was trying out the Ara / Svelte (Micro App1) / Vue (Micro App 2) / Nuxt JS (Appshell) as described in https://ara-framework

相关标签:
1条回答
  • 2021-01-28 18:08

    As you describe in the comments, using the NovaMount event is the best approach so far. Unfortunately, there's nothing out of the box to do it without explicitly define the bundle URLs yet.

    However, we plan to add a new feature to Nova Proxy to make that easier.

    In the getComponent helper, we can use the returnMeta property from the second parameter to return the client script URL in the Hypernova response.

    hypernova({
      getComponent (name, { returnMeta }) {
        returnMeta.src = 'http://localhost:3000/public/client.js'
      }
    })
    

    We get something like this in the Hypernova response.

    {
        "success": true,
        "error": null,
        "results": {
            "example": {
                "name": "Example",
                "HTML": "...",
                "meta": {
                    "src": "http://localhost:3000/public/client.js"
                },
                ...
            }
        }
    }
    

    We plan to inject that client URL in Nova Proxy when including the Nova views as well.

    I created this Github issue where you can follow-up on the feature progress. https://github.com/ara-framework/nova-proxy/issues/10

    0 讨论(0)
提交回复
热议问题