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

Generate pyodide assets without hashes in the filename #58548

Draft
wants to merge 2 commits into
base: staging
Choose a base branch
from

Conversation

snickell
Copy link
Contributor

@snickell snickell commented May 11, 2024

loadPyodide() hardcodes a list of path-names in JS to load from HTTP, which won't work if Rails modifies the filename to output to the dashboard/public/assets/js/pyodide/** to include a hash.

This PR adds the non-digest-assets Gem to control which assets are output without hashes in the filenames.

After this PR, RAILS_ENV=development bundle exec rake assets:precompile produces output both with and without hashes, like so:

./dashboard/public/assets/js/pyodide/0.25.1/package.json
./dashboard/public/assets/js/pyodide/0.25.1/packaging-23.1-py3-none-any-952adfd0fbede825af3ddd33cf288778a247ef83d92de2118d02e7d188e2d917.whl
./dashboard/public/assets/js/pyodide/0.25.1/packaging-23.1-py3-none-any.whl
./dashboard/public/assets/js/pyodide/0.25.1/pandas-1.5.3-cp311-cp311-emscripten_3_1_46_wasm32-15ebfb3055ea2050434ea90b16d8bbc5f0ab62bb13954d42a368530530bc831e.whl
./dashboard/public/assets/js/pyodide/0.25.1/pandas-1.5.3-cp311-cp311-emscripten_3_1_46_wasm32.whl
./dashboard/public/assets/js/pyodide/0.25.1/pyodide-lock-6526dae570ab7db75019fe2c7ccc6b7b82765c56417a498a7b57e1aaebec39f5.json
./dashboard/public/assets/js/pyodide/0.25.1/pyodide-lock.json
./dashboard/public/assets/js/pyodide/0.25.1/pyodide.asm-512042dfdd406971c6fc920b6932e1a8eb5dd2ab3521aa89a020980e4a08bd4b.js
./dashboard/public/assets/js/pyodide/0.25.1/pyodide.asm-aa920641c032c3db42eb1fb018eec611dbef96f0fa4dbdfa6fe3cb1b335aed3c.wasm
./dashboard/public/assets/js/pyodide/0.25.1/pyodide.asm.js
./dashboard/public/assets/js/pyodide/0.25.1/pyodide.asm.wasm

Generating both with/without the filename hash does double the size of the pyodide assets directory, but this doesn't seem like a big deal because its only adding 65MB atm and assets is already 4G or so.

Can test with: http://localhost-studio.code.org:3000//s/allthethings/lessons/50/levels/1

An alternative approach to the problem is here: #58547

@snickell snickell requested a review from molly-moen May 11, 2024 16:53
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 this pull request may close these issues.

None yet

1 participant