delucis / astro-embed

Low-JavaScript embed components for Astro websites
https://astro-embed.netlify.app
MIT License
166 stars 24 forks source link

Build not working with SSR adapter #124

Closed arlee17 closed 1 week ago

arlee17 commented 1 month ago

Hi! Maybe this is a known issue, I haven't found anything among the solved issues.

The build does not work with an SSR adapter, I'm using Cloudlfare and I get this error:

[ERROR] [vite] x Build failed in 2.44s
[commonjs--resolver] [plugin vite:resolve] Cannot bundle Node.js built-in "perf_hooks" imported from "node_modules/linkedom/commonjs/perf_hooks.cjs". Consider disabling ssr.noExternal or remove the built-in dependency.

Any suggestions?

I appreciate your help

delucis commented 1 month ago

Thanks for reporting @arlee17!

Looks like linkedom, which we use to parse HTML depends on some Node internals not available on Cloudflare. We probably need to look if there's a quick fix or if we need an alternative HTML parser that doesn't rely on Node APIs.

IshanKBG commented 2 weeks ago

@delucis I am also getting same issues. It would be good if this issue could be fixed

delucis commented 2 weeks ago

Hi @IshanKBG, I don’t have much time to work on this library very often unfortunately, but would certainly look at a PR if anyone has time to work on it!

IshanKBG commented 2 weeks ago

@delucis well i got it working by importing from linkedom/worker which seems to work in all js runtimes. Here is the more info I have also opened a pr so it.