You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 31, 2025. It is now read-only.
With this example below I was unable to get the environment variable by:
process.env.DEBUG
import.meta.env.DEBUG
tried cross-env or dotenv
import{endianness}from'os';// just to check if polyfilledModules workimportutilfrom'util';import{handleStaticAssets}from'./static-assets';constDEBUG=false;//set to TRUE when running in dev modeaddEventListener('fetch',async(event)=>{const{ pathname }=newURL(event.request.url);if(pathname.startsWith('/api')){event.respondWith(handleRequest(event.request));return;}if(DEBUG){// we skip miniflare and let vite handle the urlevent.respondWith(newResponse('',{headers: {'x-skip-request': ''}}));}else{// this will disable HMR in vite, so only for productionevent.respondWith(handleStaticAssets(event));}});asyncfunctionhandleRequest(){util;constobj={__dirname: __dirname,__filename: __filename,cwd: process.cwd(),global: !!global,Buffer: !!globalThis.Buffer,process: !!process,endianness: !!endianness,};returnnewResponse(JSON.stringify(obj));}