astro-embed icon indicating copy to clipboard operation
astro-embed copied to clipboard

Build not working with SSR adapter

Open arlee17 opened this issue 9 months ago • 1 comments

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

arlee17 avatar May 13 '24 18:05 arlee17

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.

delucis avatar May 15 '24 11:05 delucis

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

IshanKBG avatar Jun 19 '24 14:06 IshanKBG

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!

delucis avatar Jun 19 '24 14:06 delucis

@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.

IshanKBG avatar Jun 24 '24 08:06 IshanKBG