astro icon indicating copy to clipboard operation
astro copied to clipboard

🐛 BUG: Build fails when combining @astrojs/image with SSR

Open sandervspl opened this issue 3 years ago • 4 comments

What version of astro are you using?

1.0.0-rc.3

Are you using an SSR adapter? If so, which one?

Cloudflare

What package manager are you using?

pnpm (same happens on yarn and npm)

What operating system are you using?

Mac

Describe the Bug

When you combine the @astrojs/image integration with output: 'server' the build fails. It's failing to build the project because the image component is using multiple Node.js modules (fs, crypto, path, URL)

The error:

[commonjs--resolver] Cannot bundle Node.js built-in "node:fs/promises" imported from "node_modules/@astrojs/image/dist/utils/images.js". Consider disabling ssr.noExternal or remove the built-in dependency.
 error   Cannot bundle Node.js built-in "node:fs/promises" imported from "node_modules/@astrojs/image/dist/utils/images.js". Consider disabling ssr.noExternal or remove the built-in dependency.

Link to Minimal Reproducible Example

This example below does not run on Stackblitz. You will need to download the project, install it and then run npm run build. You will get the error above.

https://stackblitz.com/edit/github-i5zqrv?on=stackblitz

Participation

  • [ ] I am willing to submit a pull request for this issue.

sandervspl avatar Aug 01 '22 13:08 sandervspl