Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot access 'ASTRO_VERSION' before initialization #268

Closed
1 task
troolee opened this issue May 25, 2024 · 2 comments
Closed
1 task

Cannot access 'ASTRO_VERSION' before initialization #268

troolee opened this issue May 25, 2024 · 2 comments

Comments

@troolee
Copy link

troolee commented May 25, 2024

Astro Info

Astro                    v4.9.1
Node                     v21.6.0
System                   macOS (arm64)
Package Manager          npm
Output                   hybrid
Adapter                  @astrojs/cloudflare
Integrations             @astrojs/react
                         @astrojs/markdoc
                         keystatic

Describe the Bug

Astro JS + Keystatic + Cloudflare adapter v10 gives a build error:

$ npm run build

> @keystatic/templates-astro@0.0.29 build
> astro build

15:53:49 [WARN] [@astrojs/cloudflare] The current configuration does not support image optimization. To allow your project to build with the original, unoptimized images, the image service has been automatically switched to the 'noop' option. See https://docs.astro.build/en/reference/configuration-reference/#imageservice
15:53:49 [build] output: "hybrid"
15:53:49 [build] directory: /Users/*****/Projects/opposite-orbit/dist/
15:53:49 [build] adapter: @astrojs/cloudflare
15:53:49 [build] Collecting build info...
15:53:49 [build] ✓ Completed in 167ms.
15:53:49 [build] Building hybrid entrypoints...
Generated an empty chunk: "ansi-regex".
Generated an empty chunk: "emoji-regex".
Generated an empty chunk: "get-east-asian-width".
Generated an empty chunk: "lib0".
Generated an empty chunk: "string-width".
Generated an empty chunk: "strip-ansi".
Generated an empty chunk: "yjs".
Generated an empty chunk: "zod".
15:53:50 [vite] ✓ built in 795ms
15:53:50 [build] ✓ Completed in 808ms.

 building client (vite)
15:53:53 [vite] ✓ 1405 modules transformed.
15:53:53 [vite] dist/_astro/client.ib7v9FQf.js              1.72 kB │ gzip:   0.88 kB
15:53:53 [vite] dist/_astro/index.6UxExMu4.js             141.86 kB │ gzip:  45.58 kB
15:53:53 [vite] dist/_astro/keystatic-page.pAwJ_wnp.js  2,381.66 kB │ gzip: 736.01 kB
15:53:53 [WARN] [vite]
(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
15:53:53 [vite] ✓ built in 3.19s
Cannot access 'ASTRO_VERSION' before initialization
  Stack trace:
    at createAstro (file:///Users/*****/Projects/opposite-orbit/dist/_worker.js/chunks/astro_BRA7UzSu.mjs:1551:26)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async BuildPipeline.retrieveManifest (file:///Users/*****/Projects/opposite-orbit/node_modules/astro/dist/core/build/pipeline.js:93:26)
    at async staticBuild (file:///Users/*****/Projects/opposite-orbit/node_modules/astro/dist/core/build/static-build.js:109:7)
    at async AstroBuilder.run (file:///Users/*****/Projects/opposite-orbit/node_modules/astro/dist/core/build/index.js:164:7)

Steps to prepare minimum reproducible example:

  • npm create @keystatic@latest
  • npx astro add cloudflare

What's the expected result?

Build is successful

Link to Minimal Reproducible Example

https://github.com/uglyunicorn-eh/opposite-orbit

Participation

  • I am willing to submit a pull request for this issue.
@troolee
Copy link
Author

troolee commented May 25, 2024

I started getting this error after upgrading Cloudflare adapter to v10

@zanhk
Copy link

zanhk commented May 26, 2024

Hi, duplicate of #261

@alexanderniebuhr alexanderniebuhr closed this as not planned Won't fix, can't repro, duplicate, stale May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants