denoland / fresh

The next-gen web framework.
https://fresh.deno.dev
MIT License
12.17k stars 621 forks source link

Can't see unminified Preact source code in Chrome debugger #2370

Open skybrian opened 5 months ago

skybrian commented 5 months ago

I haven't been able to use Chrome's debugger to look at Preact source code, set breakpoints, and so on. Here's what I figured out so far:

Where does Preact source code come from?

Looks like Fresh sets up deno.json to get it from esm.sh/preact@10.19.2/denonext, and I do see the minified source in Chrome. Furthermore, these files do have sourcemaps, but Chrome doesn't seem to load them.

Are there any relevant Chrome settings?

I did see a setting in Chrome DevTools preferences, under "Sources":

Allow DevTools to load resources, such as source maps, from remote file paths. Disabled by default for security reasons.

However, turning it on had no apparent effect.

I also looked at "Developer Resources" (based on advice from here, but it only lists files on localhost.

Do other third-party libraries work?

Yes, I can look at Zod source that's pulled from deno.land.

Could Preact be loaded from somewhere else?

I tried switching to npms, but I don't know how to map "preact/" so that loading preact/hooks will work. I get this error:

error: Failed to resolve the specifier ""preact/hooks"" as its after-prefix portion ""hooks"" could not be URL-parsed relative to the URL prefix "npm:preact@10.19.2/" mapped to by the prefix "preact/" at https://deno.land/x/fresh@1.6.5/src/runtime/csp.ts:2:28

What could Fresh do?

Maybe there's another way to load Preact so that it works by default?