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.

Is it possible to load a sub app using `type="module"` script tag when the master app doesn't use `type="module"` script tag

See original GitHub issue

Is it possible to load a sub app using type="module script tag when the master app doesn’t use type="module script tag?

After some researching I found it seems currently qiankun uses eval to execute scripts of sub apps via import-html-entry module, which means when the javascript context of the master app isn’t a module, the javascript context of sub apps can’t use module syntax either, which is a big limitation in MICRO FRONTEND architecture.

I wonder if it’s possible to use any other ways to executing scripts instead of using eval, e.g. inserting a inline script element to the sub app?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
hronrocommented, Nov 19, 2020

@lalaze Not yet, still waiting for responses from maintainers.

2reactions
sufengyongcommented, Oct 25, 2020

@kuitos I have a similar question. I built a Vue3 subapplication using Vite. And the subapplication page has wrote “<script type="module" src="//localhost:3000/main.js" entry></script>”。 But the console keeps reporting errors. “Cannot use Import Statement outside a Module”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamically loading a module that is not in a script tag with ...
Yes you can, as long as your loader script is marked as module <script type="module"> const moduleSpecifier = '.
Read more >
JavaScript modules via script tag | Can I use... Support tables ...
Loading JavaScript module scripts (aka ES6 modules) using <script type="module"> Includes support for the nomodule attribute. Usage % of. all users, all tracked ......
Read more >
How to Include three.js in Your Projects
The first step in building a three.js app is importing the three.js files. There are three main ways to do this: download the...
Read more >
The Script element - HTML: HyperText Markup Language
The <script> HTML element is used to embed executable code or data; ... <script type="module" src="main.js"></script> <script nomodule ...
Read more >
Bundling and Building with Parcel - Beginner JavaScript
So the idea with modules is eventually we will be able to ship this script tag to the browser. Meaning we can upload...
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