Tencent / hel

A module federation SDK which is unrelated to tool chain for module consumer. 工具链无关的运行时模块联邦sdk.
https://tencent.github.io/hel/
Other
931 stars 79 forks source link

vue3中引用没加载出来,是接入的方式不对吗?而且引入的时候报错 #87

Closed wenwu01 closed 6 months ago

wenwu01 commented 7 months ago
import type { App } from 'vue';
import { preFetchLib, bindVueRuntime } from 'hel-micro';

const fetchOptions = {
    async getSubAppAndItsVersionFn() {
        // preview: https://hel-eco.github.io/hel-tpl-remote-vue-comp/as_v1/index.html
        const res = await fetch(
            'https://hel-eco.github.io/hel-tpl-remote-vue-comp/as_v1/hel-meta.json',
        );
        const meta = await res.json();
        return meta;
    },
};

export const setHelMicro = async (Vue: App) => {
    bindVueRuntime({ Vue });
    // from unpkg by default
    // preview: https://unpkg.com/hel-tpl-remote-vue-comps@1.1.3/hel_dist/index.html
    // await preFetchLib('hel-tpl-remote-vue-comps');

    // from user custom deploy location
    // preview: https://hel-eco.github.io/hel-tpl-remote-vue-comp/index.html
    await preFetchLib('hel-tpl-remote-vue-comps', fetchOptions);
};
fantasticsoul commented 7 months ago

你参考这两个codesanbox 示例对比下 1 预加载模式 https://codesandbox.io/s/demo-load-remote-vue3-comp-2fd34s?file=/src/main.js 2 懒加载模式 https://codesandbox.io/p/devbox/demo-load-remote-vue3-comp-lazy-4lc86z

wenwu01 commented 7 months ago

这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。

fantasticsoul commented 6 months ago

无回复,暂关闭

wenwu01 commented 6 months ago

这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。