denoland / denoland/deploy_feedback

[Bug]: Astro build fails when importing `@astrojs/react` in `astro.config.mjs`

Open
#887 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
79
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### Problem description

The build step for an `Astro` site (default blog template) fails ([example build log](https://app.deno.com/tolu/personal-web/builds/8q1279npx7w1)) when adding the `@astrojs/react` integration in `astro.config.mjs`. No react-component even imported.

Locally, when installing building and running the site with Deno v2.4 this works just fine.

Build output:

```
06:35:59 [build] Building server entrypoints...
06:35:59 [ERROR] [vite] ✗ Build failed in 101ms
[vite]: Rollup failed to resolve import "react" from "/tmp/build/src/node_modules/.deno/@astrojs+react@4.3.0/node_modules/@astrojs/react/dist/server.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
Stack trace:
at viteLog (file:///tmp/build/src/node_modules/.deno/vite@6.3.5/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:46345:15)
at onwarn (file:///tmp/build/src/node_modules/.deno/@vitejs+plugin-react@4.6.0/node_modules/@vitejs/plugin-react/dist/index.mjs:104:9)
at onRollupLog (file:///tmp/build/src/node_modules/.deno/vite@6.3.5/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:46393:5)
at file:///tmp/build/src/node_modules/.deno/rollup@4.45.0/node_modules/rollup/dist/es/shared/node-entry.js:20806:32
at ModuleLoader.handleInvalidResolvedId (file:///tmp/build/src/node_modules/.deno/rollup@4.45.0/node_modules/rollup/dist/es/shared/node-entry.js:21432:26)
(exit code 1)
```

### Steps to reproduce

1. Setup standard astro blog template (`npm create astro@latest`)
2. add `@astrojs/react` integration like so to `astro.config.mjs`:
```ts
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import deno from "@deno/astro-adapter";
import react from "@astrojs/react";

export default defineConfig({
site: 'https://example.com',
integrations: [mdx(), sitemap(), react()],
output: "server",
adapter: deno(),
});
```

### Expected behavior

The build step should succeed

### Environment

- Deno version 2.4
- Environment Deno Deploy 2.0

### Possible solution

_No response_

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with the standard Astro blog template, the shown astro.config.mjs integration, Deno 2.4, and Deno Deploy 2.0. Compare the deployment build with the successful local build and trace the @astrojs/react import resolution; done means the deployment build succeeds without importing a React component.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
build-system, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.