PlayForm / Compress

🗜️ Compress —

Home Page:https://NPMJS.Org/@playform/compress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Throws error while using along with cloudflare adopter

abdul-architect opened this issue · comments

When using cloudflare adapter to deploy in pages. During built time I get an error with node:stream.

Hi, can you paste your error log?

Hi, can you paste your error log?

Since the original issue creator has vanished into the void, here are some logs:

No error logs from AstroCompress

... other build log, it should upload worker (For Astro SSR) and upload other documents and medias to Cloudflare server at this step

21:44:57.806 | Found _worker.js in output directory. Uploading.

21:44:59.106 | ✘ [ERROR] 1 error(s) and 0 warning(s) when compiling Worker.
21:44:59.107 |  
21:44:59.108 |  
21:44:59.110 |  
21:44:59.112 | ✘ [ERROR] Could not resolve "node:stream"
21:44:59.112 |  
21:44:59.112 | _worker.js:58:14965:
21:44:59.112 | 58 │ ...Writable:e}=await import("node:stream");return e}function Ma(e)...
21:44:59.112 | ╵                             ~~~~~~~~~~~~~
21:44:59.113 |  
21:44:59.113 | The package "node:stream" wasn't found on the file system but is built into node.
21:44:59.113 | Add the "nodejs_compat" compatibility flag to your Pages project to enable Node.js compatibility.
21:44:59.113 |  
21:44:59.113 |  
21:44:59.113 | ✘ [ERROR] Build failed with 1 error:
21:44:59.114 |  
21:44:59.114 | _worker.js:58:14965: ERROR: Could not resolve "node:stream"

Well, I managed to solve it by excluding some files:

Adding this to AstroCompress config fixed this issue for me:

{
  Exclude: ["_routes.json", "_worker.mjs", "_noop-middleware.mjs", "renderers.mjs"]
}

image