What problem does this solve?
I'd like to enable the Oxc React Compiler directly through @astrojs/react, without writing a separate Vite transform or changing existing Babel configuration.
Proposed API
import react from '@astrojs/react';
import { defineConfig } from 'astro/config';
export default defineConfig({
integrations: [react({ compiler: true })],
});
Users would install oxc-transform-react, plus react-compiler-runtime for React 17/18. An options object should also be accepted for compiler configuration.
Compatibility
This should be an opt-in, non-breaking addition. Existing projects should keep working without configuration changes, including projects using custom Babel plugins or Babel configuration callbacks.
Vite's React plugin supports the Oxc compiler in v6, but that version removes the babel option. Keeping Astro's current React plugin and adding an Oxc transform ahead of it would let us expose the compiler without requiring that migration.
Compilation should apply to client components, respect the integration's file filters, and preserve hydration and Fast Refresh. The scope is @astrojs/react.
Related work
Implementation: #17951. It preserves Babel support and includes a minor changeset.
Related: #14955 proposes an option for the Babel-based React Compiler.
What problem does this solve?
I'd like to enable the Oxc React Compiler directly through
@astrojs/react, without writing a separate Vite transform or changing existing Babel configuration.Proposed API
Users would install
oxc-transform-react, plusreact-compiler-runtimefor React 17/18. An options object should also be accepted for compiler configuration.Compatibility
This should be an opt-in, non-breaking addition. Existing projects should keep working without configuration changes, including projects using custom Babel plugins or Babel configuration callbacks.
Vite's React plugin supports the Oxc compiler in v6, but that version removes the
babeloption. Keeping Astro's current React plugin and adding an Oxc transform ahead of it would let us expose the compiler without requiring that migration.Compilation should apply to client components, respect the integration's file filters, and preserve hydration and Fast Refresh. The scope is
@astrojs/react.Related work
Implementation: #17951. It preserves Babel support and includes a minor changeset.
Related: #14955 proposes an option for the Babel-based React Compiler.