originjs / vite-plugin-federation

Module Federation for vite & rollup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exporting variables from the shared module, the variables within the shared module appear as undefined

platec opened this issue · comments

test.js

import { ref, onMounted } from 'vue';

export function test() {
  const dataSource = ref([]);

  onMounted(() => {
    dataSource.value = [1, 2, 3];
  });
}

export { h } from 'vue';

after vite building

import { importShared, __tla as __tla_0 } from "./__federation_fn_import-B4BZ4M9v.js";
let h, test;
let __tla = Promise.all([
  (() => {
    try {
      return __tla_0;
    } catch {
    }
  })()
]).then(async () => {
  const { ref, onMounted } = await importShared("vue");
  test = function() {
    const dataSource = ref([]);
    onMounted(() => {
      dataSource.value = [
        1,
        2,
        3
      ];
    });
  };
});
export {
  __tla,
  h,
  test
};

related issue #496