Remove node:path and process.nextTick dependency
Closed this issue · 7 comments
Remove node:path
and process.nextTick
dependency to support edge runtimes.
Here is a working example running on vercel edge:
https://hono-react-nitedani-nitedanis-projects.vercel.app/dynamic?_vercel_share=iFkEgX1gF9U1hM806vEBdiywntbfo7CA
All I had to do:
- replace
path.join(a,b)
witha + "/" + b
- of course this is just for showcase - comment out asserts depending on
path
- replace
process.nextTick
withsetTimeout
All I had to do:
- replace
path.join(a,b)
witha + "/" + b
- of course this is just for showcase- comment out asserts depending on
path
- replace
process.nextTick
withsetTimeout
Do you still have that diff somewhere?
Second this! Currently cloudflare throws"Error: Dynamic require of \"node:path\" is not supported"
during runtime even with node compat mode enabled.
@brillout I would be up for it. Would use the path drop in replacement https://github.com/unjs/pathe though, as I see there is more then just path joining involved.
You probably want to keep the runtime code dependency free, so I would drop the 3 file from pathe into the src. What do you think?
How about we start with the pathe
npm package at first and in a minimal fashion (i.e. only using for the runtime and not for the Vite plugin). Let's then see whether we can remove or trim down pathe
.
PR: #126
had to replace usage of path.posix.* with path.* as pathe does not provide that api
telefunc@0.1.82
the server runtime shouldn't depend on Node.js anymore (I didn't test it though so let me know if there's still a Node.js dependency somewhere).