-
-
Notifications
You must be signed in to change notification settings - Fork 815
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
FIX for webpack: Export binary files in javascript package #3085
Conversation
This adds the distributed binary files to the "exports" section of the package.json file. This allows the files to be referenced, e.g. by `require.resolve('pyodide/distutils.tar')` which is useful for tools like webpack.
ad2ca77
to
acd2407
Compare
Another user who would benefit from this change: https://github.com/mneil/pyodide-webpack/blob/main/patch.js |
Well we can do this but we probably won't call it a breaking change if we rename, move, or delete these files since they are supposed to be internal. |
But I suppose that the webpack use case only relies on the fact that we export all files that we need internally so if we move them it won't break webpack users. |
Oh I see they are here: |
That would be great - unless you use something like Create React App that doesn't allow access to the webpack config. |
This makes the required changes to use Pyodide and Python packages offline and use a fixed version of the Python packages instead of fetching the latest from PyPI. There were a number of issues encountered with Pyodide webpack compatibility that were fixed using `yarn patch`: - pyodide/pyodide#3080 - pyodide/pyodide#3085 - pyodide/pyodide#3086 - pyodide/pyodide#3087 Issue: https://github.com/pybricks/pybricks-code/issues/932
I don't think Pyodide is ever likely to work with create react app, though of course if someone figures out a way maybe we can think about supporting it. The best we can do for now is to document that we don't know how to use them together. |
I would appreciate it if someone else could help with this though. I've tried to write a webpack plugin several times but always run into the problem that I was unable to use webpack with Pyodide at all. Perhaps with @mneil's example I would have an easier time, but the webpack plugin API is also very confusing. If it's just a wrapper around In @mneil's example, he also patches |
Thanks for all your help with this @dlech! |
There is no longer a file called distutils.tar
Since this PR was opened, we apparently changed the name of |
Description
This adds the distributed binary files to the "exports" section of the package.json file. This allows the files to be referenced, e.g. by
require.resolve('pyodide/distutils.tar')
which is useful for tools like webpack.Checklists