[ty] fix ty playground initialization and vite optimization issues#21471
Merged
MichaReiser merged 4 commits intoastral-sh:mainfrom Nov 25, 2025
Merged
[ty] fix ty playground initialization and vite optimization issues#21471MichaReiser merged 4 commits intoastral-sh:mainfrom
MichaReiser merged 4 commits intoastral-sh:mainfrom
Conversation
MichaReiser
reviewed
Nov 15, 2025
| export default defineConfig({ | ||
| plugins: [react(), tailwindcss(), viteStaticCopyPyodide()], | ||
| optimizeDeps: { exclude: ["pyodide"] }, | ||
| optimizeDeps: { exclude: ["pyodide", "ty_wasm"] }, |
Member
There was a problem hiding this comment.
We use vite for the production builds. Can you verify that the vite build reported sizes are the same before and after your changes
Collaborator
Author
There was a problem hiding this comment.
Sure. Build results on Ubuntu (@ WSL2):
main:
❯ dust ty/dist
24K ┌── Astral.png │█ │ 0%
20K │ ┌── pyodide.mjs │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
20K │ ├── solidity-CVYD1GVc.js │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
24K │ ├── tsMode-De4b9PNo.js │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
36K │ ├── cssMode-cNRTyZYV.js │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
36K │ ├── htmlMode-BieFvPPN.js │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
44K │ ├── ffi.d.ts │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
44K │ ├── jsonMode-B6VJCXeF.js │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
68K │ ├── pyodide.d.ts │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
84K │ ├── pyodide.js.map │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
84K │ ├── pyodide.mjs.map │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
92K │ ├── codicon-B_Z2XQ3P.ttf │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
112K │ ├── pyodide-lock.json │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
144K │ ├── editor-BhPcksyq.css │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
396K │ ├── index-BeD-OYFt.js │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 1%
1.0M │ ├── pyodide.asm.js │███░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 4%
2.3M │ ├── python_stdlib.zip │█████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 8%
3.5M │ ├── editor.main-ClkAP-6o.js │████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 12%
8.2M │ ├── pyodide.asm.wasm │██████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 29%
11M │ ├── ty_wasm_bg-Bd9OBY4A.wasm│██████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 41%
28M ├─┴ assets │█████████████████████████████████████████████████████████████ │ 100%
28M ┌─┴ dist │█████████████████████████████████████████████████████████████ │ 100%❯ dust ty/dist
24K ┌── Astral.png │█ │ 0%
20K │ ┌── pyodide.mjs │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
20K │ ├── solidity-CVYD1GVc.js │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
24K │ ├── tsMode-Bzlyl_WG.js │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
36K │ ├── cssMode-BItooz1B.js │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
36K │ ├── htmlMode-XS2Ok6yb.js │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
44K │ ├── ffi.d.ts │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
44K │ ├── jsonMode-Bw4_M6_V.js │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
68K │ ├── pyodide.d.ts │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
84K │ ├── pyodide.js.map │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
84K │ ├── pyodide.mjs.map │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
92K │ ├── codicon-B_Z2XQ3P.ttf │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
112K │ ├── pyodide-lock.json │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
144K │ ├── editor-BhPcksyq.css │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 0%
396K │ ├── index-B_J2zKKC.js │█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 1%
1.0M │ ├── pyodide.asm.js │███░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 4%
2.3M │ ├── python_stdlib.zip │█████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 8%
3.5M │ ├── editor.main-CF30gs3G.js │████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 12%
8.2M │ ├── pyodide.asm.wasm │██████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 29%
11M │ ├── ty_wasm_bg-C8Ofe_-K.wasm│██████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 41%
28M ├─┴ assets │█████████████████████████████████████████████████████████████ │ 100%
28M ┌─┴ dist │█████████████████████████████████████████████████████████████ │ 100%This result is consistent with what the vite document states.
47ad620 to
6d632b1
Compare
MichaReiser
approved these changes
Nov 16, 2025
carljm
added a commit
to mtshiba/ruff
that referenced
this pull request
Nov 25, 2025
* main: [ty] Implement `typing.override` (astral-sh#21627) [ty] Avoid expression reinference for diagnostics (astral-sh#21267) [ty] Improve autocomplete suppressions of keywords in variable bindings [ty] Only suggest completions based on text before the cursor Implement goto-definition and find-references for global/nonlocal statements (astral-sh#21616) [ty] Inlay Hint edit follow up (astral-sh#21621) [ty] Implement lsp support for string annotations (astral-sh#21577) [ty] Add 'remove unused ignore comment' code action (astral-sh#21582) [ty] Refactor `CheckSuppressionContext` to use `DiagnosticGuard` (astral-sh#21587) [ty] Improve several "Did you mean?" suggestions (astral-sh#21597) [ty] Add more and update existing projects in `ty_benchmark` (astral-sh#21536) [ty] fix ty playground initialization and vite optimization issues (astral-sh#21471)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I tried to build the ty playground on my Windows machine and run it locally, but it didn't work. I got the following error:
Also, nothing is displayed when I access localhost:5173. The following error appears in the browser console:
This PR fixes the above issues.
First, for the first issue with vite-plugin-static-copy, I addressed it by changing backslashes
\to slashes/in the path name. This is a common Windows-specific path handling issue.For the other issue, I changed the
ty_wasmpackage import from a relative path to a package name, and excludedty_wasmfromoptimizeDepsin vite.config.js.To be honest, I'm not familiar with vite, so I'm not sure why this worked, but I tried the workaround described here:
vitejs/vite#8427
The above changes are for development purposes only and should not affect the content actually delivered.
Test Plan
N/A