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

CrossOriginWorker doesn't work with WebWorker type=module #1217

Closed
whitphx opened this issue Jan 8, 2025 · 0 comments · Fixed by #1219
Closed

CrossOriginWorker doesn't work with WebWorker type=module #1217

whitphx opened this issue Jan 8, 2025 · 0 comments · Fixed by #1219

Comments

@whitphx
Copy link
Owner

whitphx commented Jan 8, 2025

<!doctype html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, shrink-to-fit=no"
    />
    <title>Stlite App</title>
  </head>
  <body>
    <div id="root"></div>
    <script type="module">
      import * as stlite from "https://whitphx.github.io/stlite/lib/mountable/stlite.js";
      stlite.mount(
        `
import streamlit as st

name = st.text_input('Your name')
st.write("Hello,", name or "world")
`,
        document.getElementById("root"),
      );
    </script>
  </body>
</html>

The error log look like

index-BbHjSJ8n.js:9 Loading a worker script from a different origin: https://whitphx.github.io/stlite/lib/mountable/assets/worker-DB8fls9q.js
18:38:15.167 9d07ca4a-a4fc-4b8b-9579-184aeec18e0d:1 Uncaught TypeError: Failed to execute 'importScripts' on 'WorkerGlobalScope': Module scripts don't support importScripts().
    at 9d07ca4a-a4fc-4b8b-9579-184aeec18e0d:1:1
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

Successfully merging a pull request may close this issue.

1 participant