Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/plugin-react-oxc/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { readFileSync } from 'node:fs'
import * as vite from 'vite'
import type { BuildOptions, Plugin } from 'vite'
import {
addRefreshWrapper,
Expand Down Expand Up @@ -35,6 +36,8 @@ export default function viteReact(opts: Options = {}): Plugin[] {
const jsxImportRuntime = `${jsxImportSource}/jsx-runtime`
const jsxImportDevRuntime = `${jsxImportSource}/jsx-dev-runtime`

const isRolldownVite = 'rolldownVersion' in vite

const viteConfig: Plugin = {
name: 'vite:react-oxc:config',
config(userConfig, { command }) {
Expand Down Expand Up @@ -70,7 +73,7 @@ export default function viteReact(opts: Options = {}): Plugin[] {
)
},
options() {
if (!this.meta.rolldownVersion) {
if (!isRolldownVite) {
throw new Error(
'@vitejs/plugin-react-oxc requires rolldown-vite to be used. ' +
'See https://vitejs.dev/guide/rolldown for more details about rolldown-vite.',
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-rsc/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { pathToFileURL } from 'node:url'
import { createRequestListener } from '@remix-run/node-fetch-server'
import * as esModuleLexer from 'es-module-lexer'
import MagicString from 'magic-string'
import * as vite from 'vite'
import {
type BuilderOptions,
type DevEnvironment,
Expand Down Expand Up @@ -1269,7 +1270,7 @@ function customOptimizerMetadataPlugin({
environments: {
client: {
optimizeDeps:
'rolldownVersion' in this.meta
'rolldownVersion' in vite
? ({
rolldownOptions: {
plugins: [optimizerPluginRolldown()],
Expand Down