Issue with imageService: cloudflare in Astro Build Process
Astro Info
Astro v4.8.6
Node v20.13.1
System Windows (x64)
Package Manager npm
Output server
Adapter @astrojs/cloudflare
Integrations @astrojs/tailwind
@astrojs/react
Describe the Bug
I recently updated my AstroJS project dependencies and encountered a build error when using the imageService: cloudflare option in the astro.config.mjs file. The build process runs without issues when this option is removed. This problem persists even in a completely new and empty project.
Steps to Reproduce Create a new AstroJS project. Add the @astrojs/cloudflare adapter. Set the imageService to cloudflare in the astro.config.mjs file. Run npm run build.
Actual Behavior The build process fails with the following error:
Cannot access 'baseService' before initialization
Stack trace:
at file:///path/to/project/dist/_worker.js/chunks/@astrojs_ykMyPNBg.mjs:405:17
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async generatePages (file:///path/to/project/node_modules/astro/dist/core/build/generate.js:60:16)
at async AstroBuilder.build (file:///path/to/project/node_modules/astro/dist/core/build/index.js:133:5)
at async build (file:///path/to/project/node_modules/astro/dist/core/build/index.js:45:3)
What's the expected result?
The build process should complete successfully without errors.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-eymk2p?file=astro.config.mjs
Participation
- [ ] I am willing to submit a pull request for this issue.
@dbell11 Thanks for the issue. I see the issue you describe in Stackblitz, but when I download the project and build it locally, I don't see the issue. Do you also have the issue locally?
@alexanderniebuhr Thank you for your prompt response!
Yes, I am encountering the issue both locally and in Stackblitz. Here is a screenshot. Additionally, I would like to note that "npm run dev" works perfectly. The issue arises specifically during the build process (npm run build).
This should be fixed in the v11 release, which will be published later today to npm.