question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: fn is not a function when modify shared-routing dashboard public index.html

See original GitHub issue

I find http://localhost:3000/remoteEntry.js script file is load twice, one in head and another in body. So I delete the script in head. Modify code module-federation-examples/shared-routing/dashboard/public/index.html

<html>

<head>
  <script src="http://localhost:3000/remoteEntry.js"></script>
  <!-- <script src="http://localhost:3001/remoteEntry.js"></script> -->
  <script src="http://localhost:3002/remoteEntry.js"></script>
  <script src="http://localhost:3003/remoteEntry.js"></script>
  <script src="http://localhost:3004/remoteEntry.js"></script>
</head>

<body>
  <div id="root"></div>
</body>

</html>

then run the Apps, visit http://localhost:3001/dashboard image

index.html structure image

Why 3001/remoteEntry.js file load order will cause the error? must manual add script in order?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

68reactions
vania22commented, Mar 14, 2021

The problem I think is because you have the element with id which is equals to the name of your remote component. Try to find that element and change the id of it

2reactions
Hall-e3commented, May 27, 2022

make the id of the div in the body of the HTML file of the different micro apps i.e container and dashboard different

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: fn is not a function - discord.js - Stack Overflow
Your problem is this: message.guild.roles.cache.find()(args[1])); . First, find takes a function, (which causes the error shown).
Read more >
JavaScript: Uncaught TypeError: n is not a function
This error occurs if you try to execute a function that is not initialized or is not initialized correctly.
Read more >
WordPress 5.6 error “t.hasOwnProperty is not a function”
I am using default WordPress theme “Twenty Twenty-One” and all dashboard functionalities are broken. ... utils.min.js?ver=3.2.8.1:1 Uncaught TypeError: t.
Read more >
Uncaught TypeError: $(...).sideNav is not a function
19.1/dist/index.html. However, I am getting these errors: 1) Uncaught ReferenceError: $ is not defined but jquery.min.js is included at the ...
Read more >
How to solve the "is not a function" error in JavaScript
js we use require() to load external modules and files. This can cause, in some cases, an error like this: TypeError: require(...) is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found