Description
graphql-request v7.4.0 fails to resolve graphql module with Astro 7 (Rolldown bundler).
Error
Cannot find package 'graphql' imported from /node_modules/graphql-request/build/legacy/helpers/analyzeDocument.js
Environment
- graphql-request: v7.4.0
- astro: v7.0.3
- bundler: Rolldown
- node: 22.20.0
Root Cause
Astro 7 uses Rolldown (strict ESM). Code in /build/legacy/ imports 'graphql' as bare module. Rolldown cannot resolve (not in valid ESM path).
Astro 5 (esbuild) resolvÃa automático. Astro 7 (Rolldown) es strict.
Workarounds Tried
- Install graphql explicitly (it works, but dont want to instal graphQL)
Solution Needed
Update /build/legacy/ to use explicit ESM paths, or remove if legacy.
Blocks Astro 7 upgrade for projects using graphql-request.
LABELS:
bug, astro, esm
Description
graphql-request v7.4.0 fails to resolve
graphqlmodule with Astro 7 (Rolldown bundler).Error
Cannot find package 'graphql' imported from /node_modules/graphql-request/build/legacy/helpers/analyzeDocument.js
Environment
Root Cause
Astro 7 uses Rolldown (strict ESM). Code in /build/legacy/ imports 'graphql' as bare module. Rolldown cannot resolve (not in valid ESM path).
Astro 5 (esbuild) resolvÃa automático. Astro 7 (Rolldown) es strict.
Workarounds Tried
Solution Needed
Update /build/legacy/ to use explicit ESM paths, or remove if legacy.
Blocks Astro 7 upgrade for projects using graphql-request.
LABELS:
bug, astro, esm