-
-
Notifications
You must be signed in to change notification settings - Fork 844
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
Pyodide fails to load after require.js #4863
Comments
Thanks for the report. This is because loading require.js has a side effect of defining I get a headache when I see all this commonjs, umd, and amd stuff. I think it would be a good idea to remove the legacy code from the error-stack-parser and just embed the necessary parts into pyodide. |
cc: @RulerOfCakes I wonder if you have some experience in dealing with this kind of CommonJS / AMD issues. |
Although I'm also not that familiar with these types of module conflict issues, it seems that esbuild isn't exactly friendly with the UMD syntax(evanw/esbuild#507), hence the UMD syntax 'leaking out' even from an ESM build of pyodide is non trivial to avoid. With the AMD globals present in the environment as you have pointed out, this ends up resolving to an AMD export. I'm not sure if there are any trivial fixes aside from embedding the dependency itself or messing around with regexes in the build step, or forcefully removing the AMD globals in the build output. A better/safer way to prevent these types of unexpected conflicts caused by globals in the future would perhaps be something like using the upcoming ShadowRealm API, which is under development for V8 / Node. |
I see. Thanks for the help. I'll see if I can vendor error-stack-parser. |
🐛 Bug
When loading require.js before Pyodide, calling
loadPyodide
results in an error:Uncaught (in promise) TypeError: z.default.parse is not a function
This corresponds to
pyodide/src/js/compat.ts
Line 263 in f1acd57
No error occurs if Pyodide is loaded first (at least not apparently).
To Reproduce
It's pretty much the first example in the docs but with
requirejs
loaded ahead of pyodide. I'm loading pyodide in a module as that helps track the source but the error is the same even without modules.Expected behavior
Pyodide should load
Environment
Platform: Arch Linux
Additional context
I tested this with each version of Pyodide from v0.21.0 onward. The latest version of Pyodide which is compatible seems to be 0.23.4
The text was updated successfully, but these errors were encountered: