tachyon-ops / react_vue_ts

Vuera TS lib
22 stars 2 forks source link

Error: Could not resolve "uuid" #10

Open AlphaGeek opened 10 months ago

AlphaGeek commented 10 months ago

Trying to load a React component in Vue3 using a micro frontend Vue3 host (federation). Getting this error when using vuera-ts:

**[ERROR] Could not resolve "uuid"

node_modules/vuera-ts/dist/wrappers/ReactWrapper.js:4:19:
  4 │ import { v4 } from "uuid";
    ╵                    ~~~~~~

You can mark the path "uuid" as external to exclude it from the bundle, which will remove this error.**

Simple code in host's App.vue

<template>
  <HelloInVue />
</template>

<script setup>
import { ReactInVue } from "vuera-ts";

const HelloInVue = ReactInVue(() => import("remote_app3/Hello"));

also tried to register Hello as an app component in main.ts (original way I had it)

import { createApp, defineAsyncComponent } from 'vue'
import './style.css'
import App from './App.vue'
import Hello from "remote_app3/Hello"

const app = createApp(App)
const Hello = defineAsyncComponent(() => import("remote_app3/Hello"));

app.component("Hello", Hello);
app.mount('#app')

then changed to this in the App.vue file:

const HelloInVue = ReactInVue(() => Hello);`

same error

tachyon-ops commented 10 months ago

Hi @AlphaGeek , thanks for reporting this. I do not have resources to pursue this, but I'd suspect it is related to how vuera-ts packaging is made. I didn't test this lib in a federated Vue3 host.

If you're up for a PR I can help you out. Also, if you want to provide a stripped down example I can quickly try to figure this out.