react-compiler-webpack icon indicating copy to clipboard operation
react-compiler-webpack copied to clipboard

fix: Accept partial plugin options

Open danreeves opened this issue 6 months ago • 1 comments

Resolves #9

Currently the PluginOptions exported by babel-plugin-react-compiler expects most keys to be populated but in reality the babel plugin accepts partial objects, so it would be better if defineReactCompilerLoaderOption accepted Partial<PluginOptions>.

defineReactCompilerLoaderOption({ target: '17' }) is valid but the types won't accept it.

Screenshot 2025-06-09 at 16 30 27

As a workaround, users can just set options: { target: '17' }, but then you lose typing.

danreeves avatar Jun 09 '25 15:06 danreeves

Maybe the PR should be opened to the upstream instead. IIRC they are using zod, so this should be very easy to update.

SukkaW avatar Jun 13 '25 04:06 SukkaW

Closing, since this kind of types update should be submitted to the upstream (facebook/react) instead.

SukkaW avatar Dec 17 '25 12:12 SukkaW

Probably resolved by https://github.com/facebook/react/pull/34550

danreeves avatar Dec 17 '25 12:12 danreeves