{"record":{"id":"dd4238fe37698b3e","repo":"rolldown/rolldown","slug":"missing-options-for-vitereactrefreshwrapperplugin","errorCode":null,"errorMessage":"Missing options for ViteReactRefreshWrapperPlugin","messagePattern":"Missing options for ViteReactRefreshWrapperPlugin","errorType":"validation","errorClass":"napi::Error","httpStatus":null,"severity":"error","filePath":"crates/rolldown_binding/src/options/plugin/binding_builtin_plugin.rs","lineNumber":161,"sourceCode":"            napi::Status::InvalidArg,\n            \"Missing options for ViteManifestPlugin\",\n          ));\n        };\n        Arc::new(plugin)\n      }\n      BindingBuiltinPluginName::ViteModulePreloadPolyfill => {\n        let plugin = if let Some(options) = plugin.options {\n          BindingViteModulePreloadPolyfillPluginConfig::from_unknown(options)?.into()\n        } else {\n          ViteModulePreloadPolyfillPlugin::default()\n        };\n        Arc::new(plugin)\n      }\n      BindingBuiltinPluginName::ViteReactRefreshWrapper => {\n        let config = if let Some(options) = plugin.options {\n          BindingViteReactRefreshWrapperPluginConfig::from_unknown(options)?\n        } else {\n          return Err(napi::Error::new(\n            napi::Status::InvalidArg,\n            \"Missing options for ViteReactRefreshWrapperPlugin\",\n          ));\n        };\n        Arc::new(ViteReactRefreshWrapperPlugin::new(config.into()))\n      }\n      BindingBuiltinPluginName::ViteReporter => {\n        let plugin: ViteReporterPlugin = if let Some(options) = plugin.options {\n          BindingViteReporterPluginConfig::from_unknown(options)?.into()\n        } else {\n          return Err(napi::Error::new(\n            napi::Status::InvalidArg,\n            \"Missing options for ViteReporterPlugin\",\n          ));\n        };\n        Arc::new(plugin)\n      }\n      BindingBuiltinPluginName::ViteResolve => {","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/rolldown/rolldown/blob/91b44b9d7bcfb5725533478e044e3891a251b2c5/crates/rolldown_binding/src/options/plugin/binding_builtin_plugin.rs#L143-L179","documentation":"ViteReactRefreshWrapper requires its wrapper configuration; try_from returns a NAPI InvalidArg error when the plugin binding has no options, since BindingViteReactRefreshWrapperPluginConfig cannot be constructed from nothing.","triggerScenarios":"Registering the ViteReactRefreshWrapper builtin plugin without options — e.g. { name: 'vite:react-refresh-wrapper' } with no config (preamble code, react refresh paths etc. missing).","commonSituations":"Setting up React HMR through rolldown's builtin plugin manually; the integration that normally injects the refresh wrapper options is bypassed or misconfigured.","solutions":["Supply the options object with the React refresh wrapper config","Check BindingViteReactRefreshWrapperPluginConfig for required fields (e.g. preamble code, include/exclude)","Use the official Vite/rolldown React integration instead of hand-registering the plugin","Ensure the plugin name matches the binding enum so options parsing happens on the right branch"],"exampleFix":"// before\nbuiltinPlugins: [{ name: 'vite:react-refresh-wrapper' }]\n// after\nbuiltinPlugins: [{ name: 'vite:react-refresh-wrapper', options: { preambleCode: '...', include: [/\\.tsx?$/] } }]","handlingStrategy":"validation","validationCode":"const refresh = builtinPlugins.find(p => p.name === 'vite:react-refresh-wrapper');\nif (refresh && !refresh.options) {\n  throw new Error('vite:react-refresh-wrapper requires options (preambleCode, include/exclude)');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Supply preamble and include patterns when enabling React refresh","Use the official Vite React + rolldown integration instead of manual registration","Snapshot-test your builtin plugin config construction"],"tags":["plugin","napi","missing-options"],"backgroundTag":"missing-required-option","analyzedSha":"91b44b9d7bcfb5725533478e044e3891a251b2c5","analyzedAt":"2026-09-07T16:04:13.504Z","contentChangedAt":"2026-09-07T16:04:13.504Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}