Skip to content

Commit

Permalink
feat(plugin-react): ensure overrides array exists before `api.react…
Browse files Browse the repository at this point in the history
…Babel` hooks are called (#6750)
  • Loading branch information
aleclarson committed Feb 3, 2022
1 parent ff37c03 commit 104bdb5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/plugin-react/src/index.ts
Expand Up @@ -60,6 +60,7 @@ export type BabelOptions = Omit<
export interface ReactBabelOptions extends BabelOptions {
plugins: Extract<BabelOptions['plugins'], any[]>
presets: Extract<BabelOptions['presets'], any[]>
overrides: Extract<BabelOptions['overrides'], any[]>
parserOpts: ParserOptions & {
plugins: Extract<ParserOptions['plugins'], any[]>
}
Expand Down Expand Up @@ -95,6 +96,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {

babelOptions.plugins ||= []
babelOptions.presets ||= []
babelOptions.overrides ||= []
babelOptions.parserOpts ||= {} as any
babelOptions.parserOpts.plugins ||= opts.parserPlugins || []

Expand Down

0 comments on commit 104bdb5

Please sign in to comment.