Vehmloewff / hackle

A hackable logger for the 21 Century
MIT License
0 stars 0 forks source link

Broken in Deno 2.0 #4

Open gibbygano opened 1 month ago

gibbygano commented 1 month ago

Not sure if this project is still maintained, but just in case: Deno 2.0 no longer allows the window global variable.

error: Uncaught (in promise) ReferenceError: window is not defined
if (!window.hackle) window.hackle = makeHackle()
^
    at https://deno.land/x/hackle@1.1.1/init.ts:9:1

    info: window global is not available in Deno 2.
    hint: Replace `window` with `globalThis`.

I don't use hackle directly, but a consumer of hackle, fresh-seo. Thought I'd reach out on the off chance the maintainer still monitors the issues.

maclong9 commented 3 weeks ago

Also having this issue, I'm not even using fresh-seo so I think it's a direct dependency of Fresh.

gibbygano commented 3 weeks ago

Also having this issue, I'm not even using fresh-seo so I think it's a direct dependency of Fresh.

It's definitely not in fresh. I confirmed in their repo while I was trying to find the actual consumer. Also, after removing fresh-seo the issue was resolved for me. This was on latest fresh (1.7.3) and the previous (1.7.2). You might have another dependency that is consuming it.

maclong9 commented 3 weeks ago

Hmm I have no idea what it might be, is there a quick way to look at the dependencies of a package using Deno?

gibbygano commented 3 weeks ago

Hmm I have no idea what it might be, is there a quick way to look at the dependencies of a package using Deno?

With fresh-seo it wasn't even referenced in any of their ts files or deno.json. It was only in the deno.lock which is apparently still enough to break things. I had to go to each plugin/package I had and search their repo for "hackle" to find it.

Edit: in case it is directly consumed by a dependency this is how you check:


deno info <package/plugin>

Make sure to include the npm: or jsr: prefix if that is how you're consuming the dependency.

maclong9 commented 3 weeks ago

Seems mine is a dependency chain up to fresh-seo and then again to fresh/plugins/tailwind.ts which is a little annoying.

Also if you run deno info main.ts it will display the full dependency tree which is great.