Skip to content

Commit

Permalink
fix(plugin-react): avoid passing ssr and file props to babel
Browse files Browse the repository at this point in the history
  • Loading branch information
cyco130 committed May 20, 2022
1 parent ce8b12d commit 1d120d2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/plugin-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
: babel.transformAsync.bind(babel, code)

const isReasonReact = extension.endsWith('.bs.js')
const result = await transformAsync({
const transformOptions: TransformOptions = {
...babelOptions,
ast: !isReasonReact,
root: projectRoot,
Expand All @@ -303,7 +303,10 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
sourceMaps: true,
// Vite handles sourcemap flattening
inputSourceMap: false as any
})
}
delete (transformOptions as any).ssr
delete (transformOptions as any).file
const result = await transformAsync(transformOptions)

if (result) {
let code = result.code!
Expand Down

0 comments on commit 1d120d2

Please sign in to comment.