Node + NPM install dependencies in node_modules, so if I want to debug a dependency, I can just go to node_modules/some-pkg/some-file.js
and add debugger statements, console-logs, and the likes.
In Deno, things get trickier, because dependencies are abstracted from the user - it's not plain local JS files anymore! For example, If I have the following code:
// main.js
import oaClient from 'https://cdn.pika.dev/oa-client';
const { createClient } = oaClient;
createClient();
It'll output the stacktrace:
nino@hp:~/learning/deno(master)$ deno run main.js
error: Uncaught TypeError: Cannot read property 'paths' of undefined
for (var path in specs.paths) {
^
at _default (https://cdn.pika.dev/-/oa-client@v0.7.1-hYTMbsju6JnnnXlCWvdN/dist=es2019/oa-client.js:428:26)
at file:///home/nino/learning/deno/main.js:3:1
and although I can read the code online at https://cdn.pika.dev/-/oa-client@v0.7.1-hYTMbsju6JnnnXlCWvdN/dist=es2019/oa-client.js, I can't insert console logs or debugger statements.
Thanks to deno info <the URL above>
I can get the local path of the cached copy of the dependency, but I don't think that editing files in ~/.cache/deno
is the right way.
So, what's the Deno way to debug dependencies?