Commit ac02012
committed
fix: strip query strings before matching exclude patterns
Vite appends cache-busting query strings (e.g. ?t=1707350000) to module
URLs during HMR. The exclude patterns use $ anchors that expect the URL
to end with the file extension (e.g. /.*\.tsx?$/), which fails to match
URLs with query parameters.
This causes HMR module requests to leak through to the app server, which
returns 404 with text/plain MIME type. The browser rejects the module and
the page goes blank.
Fix by also testing exclude patterns against the URL path (without query
string), so /frontend/App.tsx?t=123 correctly matches /.*\.tsx?$/ via
the path portion /frontend/App.tsx.1 parent 05b898a commit ac02012
1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | | - | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
0 commit comments