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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load pyodide from different indexURL #4504

Open
savakarrohan opened this issue Feb 9, 2024 · 1 comment
Open

Unable to load pyodide from different indexURL #4504

savakarrohan opened this issue Feb 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@savakarrohan
Copy link

savakarrohan commented Feb 9, 2024

馃悰 Bug

While using a custom distribution of pyodide, I am using the indexURL of the loadPyodide settings in a react component which is being compiled using webpack. Part of the code looks like this in the useEffect of the component.

  async function hello_python() {
    let pyodide = await loadPyodide({
      indexURL: "https://cdn.jsdelivr.net/pyodide/v0.24.0/full/",
    });
    return pyodide.runPythonAsync("1+1");
  }
    hello_python().then((result) => {
      console.log("Python says that 1+1 =", result);
    });

The error stays even when I am using my own version of pyodide.

Error

Cannot find module 'https://cdn.jsdelivr.net/pyodide/v0.24.0/full/pyodide.asm.js'
    at http://localhost:3000/static/js/bundle.js:81938:11
    at async loadScript (http://localhost:3000/static/js/bundle.js:84912:43)
    at async loadPyodide (http://localhost:3000/static/js/bundle.js:85242:5)
    at async hello_python (http://localhost:3000/static/js/bundle.js:1282:19)

Environment

  • Pyodide Version: v.0.25.0
  • Browser version: edge
  • Any other relevant information:

Additional context

#4419 , #3550

image

@savakarrohan savakarrohan added the bug Something isn't working label Feb 9, 2024
@ryanking13
Copy link
Member

This is an issue with Webpack's behavior in the bundling of dynamic imports. Could you try pyodide-webpack-plugin, and see if it works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants