withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
45.6k stars 2.39k forks source link

Astro `4.14.0` build error with Cloudflare adapter #11720

Closed twodft closed 1 month ago

twodft commented 1 month ago

Astro Info

Astro                    v4.14.0
Node                     v20.5.0
System                   Windows (x64)
Package Manager          pnpm
Output                   hybrid
Adapter                  @astrojs/cloudflare
Integrations             @astrojs/mdx
                         @astrojs/tailwind
                         @astrojs/svelte
                         @astrojs/react
                         @astrojs/solid-js
                         @astrojs/sitemap
                         @astrojs/partytown
                         astro-icon

Describe the Bug

After upgrading to astrojs 4.14.0, build got an error and failed even without enabling the experimental contentLayer feature flag.

[commonjs--resolver] [plugin vite:resolve] Cannot bundle Node.js built-in "fs" imported from "node_modules\.pnpm\astro@4.14.0_@types+node@20.14.15_lightningcss@1.25.1_rollup@4.20.0_terser@5.31.6_typescript@5.5.4\node_modules\astro\dist\content\data-store.js". Consider disabling ssr.noExternal or remove the built-in dependency.
  Stack trace:
    at getRollupError (file:///D:/Projects/website/node_modules/.pnpm/rollup@4.20.0/node_modules/rollup/dist/es/shared/parseAst.js:392:41)
    at Object.error (file:///D:/Projects/website/node_modules/.pnpm/rollup@4.20.0/node_modules/rollup/dist/es/shared/node-entry.js:19707:20)
    at Object.handler (file:///D:/Projects/website/node_modules/.pnpm/vite@5.4.0_@types+node@20.14.15_lightningcss@1.25.1_terser@5.31.6/node_modules/vite/dist/node/chunks/dep-NjL7WTE1.js:65527:15)
    at async PluginDriver.hookFirstAndGetPlugin (file:///D:/Projects/website/node_modules/.pnpm/rollup@4.20.0/node_modules/rollup/dist/es/shared/node-entry.js:19792:28)
    at async ModuleLoader.resolveId (file:///D:/Projects/website/node_modules/.pnpm/rollup@4.20.0/node_modules/rollup/dist/es/shared/node-entry.js:18869:15)
 ELIFECYCLE  Command failed with exit code 1.

What's the expected result?

run astro build should get no error after upgrading astrojs to 4.14.0

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-dovhkf?file=astro.config.mjs

Participation

alexanderniebuhr commented 1 month ago

Can you provide a minimal reproduction using https://astro.new?

twodft commented 1 month ago

Can you provide a minimal reproduction using https://astro.new?

added, https://stackblitz.com/edit/github-dovhkf?file=astro.config.mjs

ascorbic commented 1 month ago

@twodft can you try installing astro@experimental--immutable-datastore to see if it fixes it for you?

twodft commented 1 month ago

@twodft can you try installing astro@experimental--immutable-datastore to see if it fixes it for you?

yes, tested and this fixed the build error. Awesome!

ascorbic commented 1 month ago

This has been released in 4.14.1