mrbbot / slshx

⚔️ Strongly-typed Discord commands on Cloudflare Workers
MIT License
210 stars 9 forks source link

Landing page not loading when using Wrangler 2 instead of miniflare #13

Open y0hami opened 2 years ago

y0hami commented 2 years ago

If using wrangler 2 dev environment (built on top of miniflare) instead of miniflare like the starter template the landing page doesn't load due to this line https://github.com/mrbbot/slshx/blob/master/src/index.ts#L43 looking for the MINIFLARE global which doesn't exist.

Current work around is to set it before handling the fetch.

(globalThis as any).MINIFLARE = true

Possible fix could be to check for the environment which is explained on this page https://developers.cloudflare.com/workers/platform/environments/