-
Notifications
You must be signed in to change notification settings - Fork 89
Question: Is it possible to run cloudworker in debug? #109
Comments
Hi @markusahlstrand, I don't understand the question. Could you give specific examples of what you are trying to accomplish and why it currently doesn't work? Thanks! |
Hi @hankjacobs, What I'm trying to accomplish is debug multiple files in visual studio code, rather than compiling to a single text file. I wonder if there is a way to achieve this with the cloudworker lib or if it's a different use case? The examples I've seen with for instance unit tests loads the worker as a text file which I assume will make debugging in vs-code difficult? Thanks! |
If you enable source map for your webpacked result, you can debug the original multiple source files just fine. As Cloudworker is not a lib, but an executor of your single-file worker code, you cannot just set a breakpoint (like you cannot set a breakpoint inside a string, which is But you can put a |
This might be a stupid question, but is there an advantage to loading the script in a node vm sandbox? Would there be a downside to just adding shims for the cloudflare runtime and executing the script straight away? That way breakpoints would work just as in any other node program with no webpack required. Or is it more a question about that cloudworker isn't a lib, but an executor? |
The advantage is dev and prod environments are as similar, as possible. Before Cloudworker existed, I actually used the approach you're describing (doing feature detection and I guess it can be very feasible approach for simple apps, though. |
I'm looking for an easy way to debug cloudflare workers wonder if this is possible with the cloudworker? I'm currently using more or less the runtime.js library from cloudworker to patch the node environment before starting the worker and it works pretty good, but it doesn't seem like the runtime is exposed? Is this possible, could it be possible or would it be better to do this in a separate project?
Thanks!
The text was updated successfully, but these errors were encountered: