Commit 8f7604d
* fix(plugins): hoist id/version regexes into defineNativePlugin to avoid TDZ on Workers
Module-scope regex consts (SIMPLE_ID/SCOPED_ID/SEMVER_PATTERN) could be read before initialization during the worker's circular module init under ssr.noExternal, throwing "Cannot access 'SIMPLE_ID' before initialization" and 500-ing every route on Cloudflare Workers. Moving them function-local makes them evaluate at call time, eliminating the temporal dead zone regardless of bundle ordering.
Closes #1370
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Update .changeset/fix-define-plugin-tdz.md
Co-authored-by: emdashbot[bot] <273199577+emdashbot[bot]@users.noreply.github.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Matt Kane <m@mk.gg>
Co-authored-by: emdashbot[bot] <273199577+emdashbot[bot]@users.noreply.github.com>
1 parent 971c627 commit 8f7604d
3 files changed
Lines changed: 37 additions & 5 deletions
File tree
- .changeset
- packages/core
- src/plugins
- tests/unit/plugins
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | 25 | | |
31 | 26 | | |
32 | 27 | | |
| |||
94 | 89 | | |
95 | 90 | | |
96 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
97 | 106 | | |
98 | 107 | | |
99 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
164 | 182 | | |
165 | 183 | | |
166 | 184 | | |
| |||
0 commit comments