Encountering issues with webpack module federation and single-spa-vue integration, specifically with Vue version 2.16.12

I'm currently facing an issue while developing a microfrontend using single-spa-vue and Vue 2.6.12.

To set up my project, I am utilizing the webpack module federation plugin.

Below is the entry point for my application:

src/app.ts

import singleSpaVue from 'single-spa-vue';
import Vue from 'vue';

import Main from './Main.vue';
import router from './router';

const lifecycles = singleSpaVue({
  Vue,
  appOptions: {
    render(h: any) {
      return h(Main as any);
    },
    router,
  } as any,
});

export const bootstrap = lifecycles.bootstrap;
export const mount = lifecycles.mount;
export const unmount = lifecycles.unmount;

The configuration details from my webpack.config.js file can be found below:

// Contents of webpack.config.js here...

/*
 * Code snippet removed for brevity
 */

In addition to these files, I have also included an index.ts file which contains the following code:

src/index.ts

import { start, registerApplication } from 'single-spa'

registerApplication({
  name: 'content',
  app: () => import('content/Content' as any),
  activeWhen: '/',
},)

start()

However, upon running yarn start and navigating to localhost:3002, I encounter the error displayed in this error image.

If anyone has encountered a similar issue or has expertise in solving such problems, your assistance would be greatly appreciated!

Thank you!

Answer №1

Perhaps there's a confusion between the relationship of the host container and remote container. I noticed in your configuration of ModuleFederationPlugin that the values for remotes and name are the same, which appears to be incorrect.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Looking for assistance grasping the concept of using a for loop in MongoDB's aggregate method

This code snippet is designed to maintain the order of an array (var list) when utilizing mongoDb's $in clause effectively. Although, I must admit that the logic behind it is not entirely clear to me. I can see that it's iterating in reverse to ...

What is the best way to connect the elements in two separate arrays?

I have a scenario with two arrays and a variable: var Names = ['jack', 'peter', 'jack', 'john']; var Ids = ['1' , '2' , '3' , '4' ]; Also, I have this search varia ...

What is the best way to eliminate concealed divs from the view source of a webpage?

On my HTML page, I have some hidden DIVs that can still be viewed in the page source. I want to ensure that these DIVs are not visible to users when they inspect the page source. Is there a way to achieve this using Javascript or another solution? ...

Problem with Ionic 2 local storage: struggling to store retrieved value in a variable

Struggling to assign the retrieved value from a .get function to a variable declared outside of it. var dt; //fetching data this.local.get('didTutorial').then((value) => { alert(value); dt = value; }) console.log("Local Storage value: " ...

Issue with Webpack: error message "Cannot read property 'readFile' of undefined" is causing no output files to be generated

When utilizing version webpack > 5, the configuration for my appDevMiddleware.js is as follows: const path = require('path'); const webpack = require('webpack'); const webpackDevMiddleware = require('webpack-dev-middleware' ...

Is there a way to use babel to convert a node module along with its dependencies?

My website doesn't function properly on Internet Explorer 11 due to issues with ipfs-api. The problem lies in the fact that this module utilizes ES6 syntax and has not been transpiled. Additionally, certain dependencies it relies on have not been t ...

How to fetch select element within a table by using jQuery

I encountered a situation where I have a table element with a select element inside its td. The id of the table (in this example, it is "table1") could potentially change. So my query is, how can I retrieve the selected option using the table ID in JQuer ...

`Back and forward function of pushState in history`

After successfully implementing ajax loading on all pages of my website, I encountered a challenge with the browser's back and forward buttons. Implementing the back button was straightforward: $(window).on('popstate', function(e) { get ...

Conflicting Transformation Properties Causing CSS Issues Within a Single Element

I'm currently working on a user interface where users can drag and drop a box with a red outline to position it on the screen within a black box. See the UI here Alternatively, users can also move the box by adjusting the inputs on the right side. ...

JS showcase of object literals and their corresponding properties

Just starting out with Javascript and eager to learn about arrays of objects. I'm currently exploring how to display an object along with its properties. Here's an example showcasing the colors of different fruits: var fruitColor = {'apples ...

Serving Files in Express JS: the benefits of serving files directly from memory compared to serving static

Should I keep images and other assets in memory or serve them from static assets? Will often-requested static assets be stored in memory? Does anyone have insight into the performance implications of this decision? ...

Experiencing a TypeError message while attempting to send header data with the nodejs request module

function loginUser(req, res) { console.log(req.body.loginemail); console.log(req.body.loginpassword); var options = { uri: webServiceURL.login,   method: "POST", body: { "login": req.body.loginemail, ...

Trouble with Mongoose save() function failing to update data

I am currently working on enhancing a fully functioning CRUD app by adding a new feature that allows users to update a list of vendors. They have the ability to add new vendors, update existing ones, and delete vendors. While the add and delete functions a ...

Toggle the play/pause function by clicking - Trigger Ajax

I have a campaign that can be either played or paused. Currently, I have implemented the pause feature using AJAX and now I need to add the play feature as well. When I click on the pause button, I want it to be replaced with the play button. This is the ...

Issues with slots functionality in my VUE defineCustomElement component

I have put together this CustomElement initialization in VUE 3 by gathering information from various online sources such as documentation and Stack Overflow. However, I couldn't find any discussion on how to handle slots in this particular type of se ...

Is there a better method to accomplish this task in a more effective manner?

Is there a more efficient way to achieve this code with fewer lines of code? I'm looking for a solution that avoids repetition and makes it easier to manage, especially since I plan on creating multiple instances of this. Performance is a key consider ...

Click on the radio button to delete all selected entries in the option dropdown

After spending the entire day trying to find a solution, I am still struggling with a simple task - how do I clear all selections from a group of select option drop downs at once without removing them? I want the selections to revert back to their default ...

What is the best way to extract value from a JSON object with jQuery?

How can I retrieve the value of 'FRI' from the JSON feed returned by an AJAX call using jQuery? $.ajax({ url: query, type: "GET", dataType: "json" success: function(data) { var day = // extract data value from JSON ...

Tips for detecting the existence of a different class within a div/ul through jquery or javascript?

This is how I have my unordered list, or "ul" element, styled. As you can observe, there are two classes defined for the ul <ul class="nav-second-level collapse"> </ul> There might be an additional class added to the same ul like so: <u ...

Struggling to get the hang of CSS animation?

Here is a code snippet that I am using: //Code for animating skills on view document.addEventListener("DOMContentLoaded", function(event) { function callback(observations, observer) { observations.forEach(observation => { if (observati ...