Vue 3 + Module Federation: Implementing modular Vue 3 applications
P粉448346289
2023-08-26 21:46:40
<p>I'm trying to build a simple micro frontend example using Vue3 and Module Federation, but I'm running into conflict issues. </p>
<p>I have the code here:
https://github.com/ghalex/mf-example</p>
<p>There are only two micro frontends: </p>
<ul>
<li>Container (Vue3)</li>
<li>Authorization (Vue3)</li>
</ul>
<p>My problem is that when I import the App.vue component: </p>
<pre class="brush:js;toolbar:false;">// index.js - in container
import App from './components/App.vue'
</pre>
<pre class="brush:js;toolbar:false;">// indexAuth.js - in auth
import App from './components/App.vue'
</pre>
<p>When loading the module into the container in the <strong>auth</strong> module, the App.vue component was overwritten. </p>
<p>Are there any webpack settings I'm missing to ensure each component is loaded individually? </p>
I found the problem, it is a
bug
of webpack-dev-server v4. I downgraded to v3 and everything is working fine.