Commit db7b501
committed
fix(dev): alias debug -> obug shim so astro dev runs on cloudflare v13
astro dev 500s on every request with "module is not defined" when the
@cloudflare/vite-plugin runner loads a component whose dep graph
includes the CJS `debug` package: it references `module.exports`, and
`module` is not a global in the workerd runner.
Astro core already replaced `debug` with `obug` (ESM fork) in
withastro/astro#15565, but integrations like expressive-code still
pull `debug` via their markdown/rehype pipelines
(expressive-code/expressive-code#439 tracks the same error).
`obug` only exposes named exports, so a raw alias breaks consumers
that do `import debug from "debug"`. Add `src/shims/debug.js` which
re-exports obug and re-exposes a default, then wire it in via
vite.resolve.alias. Install obug as a direct dependency so the shim
resolves in the Workers runner (it's only a transitive dep of astro
otherwise).
Also add .wrangler to .gitignore - the new dev mode writes local
state there.
Verified: all routes (/, /blog/, /posts/..., /about/, /archive/,
/projects/) return 200 under pnpm dev; pnpm check and pnpm build stay
green.1 parent bc7cfa0 commit db7b501
5 files changed
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
160 | 172 | | |
161 | 173 | | |
162 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments