originjs / vite-plugin-federation

Module Federation for vite & rollup
Other
2.4k stars 242 forks source link

Can I use with @module-federation/enhanced as a host application? #640

Open dante01yoon opened 5 days ago

dante01yoon commented 5 days ago

Versions

For Vite config

For webpack config

can not import vite remote app in webpack host app. Not sure this is related with vite plugin, can not use with webpack host app ``` e: Error: [ Federation Runtime ]: Failed to get remoteEntry exports. #RUNTIME-001 args: {"remoteName":"myRemoteApp","remoteEntryUrl":" ``` this is vite config from remote app ```js federation({ name: 'myRemoteApp', filename: 'remoteEntry.js', remotes: { 'myHostApp': '/resources/something/host', }, exposes: { './Spinner': './src/components/Spinner.vue', }, shared: ['vue', 'pinia', 'vue-router'], }), ``` and this is host app actually import - using vue2 ```js import { init, loadRemote } from '@module-federation/runtime'; const instance = init({ name: "myHostApp", remotes: [ { name: "myRemoteApp", entry: "/resources/my-remote-app/assets/remoteEntry.js", }, ] }) export default { // ... async mounted() { const modules = await loadRemote('myRemoteApp/Spinner'); } } ``` ``` e: Error: [ Federation Runtime ]: Failed to get remoteEntry exports. #RUNTIME-001 args: {"remoteName":"myRemoteApp","remoteEntryUrl":" ```

Steps to reproduce

What is Expected?

What is actually happening?