b-fuze / deno-dom

Browser DOM & HTML parser in Deno
https://jsr.io/@b-fuze/deno-dom
MIT License
425 stars 47 forks source link

Cannot redefine property: Symbol(Symbol.hasInstance) #92

Closed dz4k closed 2 years ago

dz4k commented 2 years ago
20:24:03.200 | TypeError: Cannot redefine property: Symbol(Symbol.hasInstance)
20:24:03.202 | at (https://deno.land/x/deno_dom@v0.1.21-alpha/src/api.ts:58:8)

Only seems to happen in the Cloudflare Pages build env, which is odd.

b-fuze commented 2 years ago

So this has come back rearing its ugly head 😩

What is this Cloudflare Pages that you speak of, and how are you running it?

dz4k commented 2 years ago

I have a Lume site I deploy on Cloudflare Pages with the following build command:

git fetch --unshallow && curl -fsSL https://deno.land/x/install/install.sh | sh && /opt/buildhome/.deno/bin/deno run -A https://deno.land/x/lume/ci.ts

The site: https://github.com/dz4k/denizaksimsek.com

dz4k commented 2 years ago

Managed to reproduce it locally.

$ deno --version
deno 1.20.6 (release, x86_64-unknown-linux-gnu)
v8 10.0.139.6
typescript 4.6.2

deno_dom@v0.1.21-alpha

b-fuze commented 2 years ago

@dz4k what code were you running?

dz4k commented 2 years ago

Minimal repro:

import "https://deno.land/x/deno_dom@v0.1.21-alpha/src/api.ts"
import "https://deno.land/x/deno_dom@v0.1.21-alpha/src/api.ts?v"

Seems like I was somehow importing the module twice. Since Object.defineProperty creates an unconfigurable property by default, the second time was failing.

b-fuze commented 2 years ago

Ah, I see... Thanks, I should probably make it configurable then... Or check that it was included twice... Hrm

b-fuze commented 2 years ago

I'm making them configurable, thanks for reporting this