Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I import a dynamically imported module within <script> tag? #13

Closed
Relaxe111 opened this issue Aug 17, 2022 · 3 comments
Closed

Comments

@Relaxe111
Copy link

Relaxe111 commented Aug 17, 2022

Hi I have a situation where i import a module dynamically with import statement inside script tag on in src.code looks like :

//index.html
<script crossorigin="">import('/__dynamic_base__/assets/index.18d6a07a.js').finally(() => {
           
   const global_concurent_qiankun = window.proxy?.__GLOBAL_CONCURENT_QIANKUN__?.['asma-app-directory']
   if(global_concurent_qiankun){
       window.proxy = global_concurent_qiankun
   }
   const qiankunLifeCycle = window.moduleQiankunAppLifeCycles && window.moduleQiankunAppLifeCycles['asma-app-directory'];
   if (qiankunLifeCycle) {
     window.proxy.vitemount((props) => qiankunLifeCycle.mount(props));
     window.proxy.viteunmount((props) => qiankunLifeCycle.unmount(props));
     window.proxy.vitebootstrap(() => qiankunLifeCycle.bootstrap());
     window.proxy.viteupdate((props) => qiankunLifeCycle.update(props));
   }
 
         })
</script>
it looks like it not changes `__dynamic_base__` placeholder inside import('...__dynamic_base__...') statement it that true?
how i can achieve that?
@Relaxe111 Relaxe111 changed the title How can I import a dynamicaly imported module within <script> tag? How can I import a dynamically imported module within <script> tag? Aug 18, 2022
@chenxch
Copy link
Owner

chenxch commented Aug 20, 2022

You can try to replace __dynamic_base__ with publicPath.

@chenxch
Copy link
Owner

chenxch commented Sep 6, 2022

Hello, since there is no feedback for a long time, I will close the issue first.

@chenxch chenxch closed this as completed Sep 6, 2022
@qsya
Copy link

qsya commented Jun 27, 2023

hi,how to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants