deploy_feedback
deploy_feedback copied to clipboard
[Bug]: Astro build fails when importing `@astrojs/react` in `astro.config.mjs`
Problem description
The build step for an Astro site (default blog template) fails (example build log) 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/@[email protected]/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/[email protected]/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:46345:15)
at onwarn (file:///tmp/build/src/node_modules/.deno/@[email protected]/node_modules/@vitejs/plugin-react/dist/index.mjs:104:9)
at onRollupLog (file:///tmp/build/src/node_modules/.deno/[email protected]/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:46393:5)
at file:///tmp/build/src/node_modules/.deno/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20806:32
at ModuleLoader.handleInvalidResolvedId (file:///tmp/build/src/node_modules/.deno/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:21432:26)
(exit code 1)
Steps to reproduce
- Setup standard astro blog template (
npm create astro@latest) - add
@astrojs/reactintegration like so toastro.config.mjs:
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