Skip to content

reactCompilerPreset() can't be used with @rolldown/plugin-babel's parallel option #1547

Description

@sumanthratna

@vitejs/plugin-react 6.2.1, @rolldown/plugin-babel 0.3.0, babel-plugin-react-compiler 1.0.0, Vite 8.3.4.

babel({ parallel: true, presets: [reactCompilerPreset()] })

fails the build:

Cannot use the "parallel" option, because "presets[0]" cannot be sent to a worker thread. Refer to plugins and presets by module name instead of by function or object.
  DataCloneError: () => ({ plugins: [[fileURLToPath(import.meta.resolve("babel-plugin-react-compiler")), options]] }) could not be cloned.

reactCompilerPreset sets preset to an inline function, which can't be sent to a worker thread. @rolldown/plugin-babel keeps rolldown.filter and the hooks on the main thread, so only preset needs to be cloneable. Shipping the preset as a module and referencing it by path with its options would make the two work together. 6.2.0 widened the peer range to ^0.3.0, so this combination looks intended.

Workaround: babel({ parallel: true, plugins: [["babel-plugin-react-compiler", opts]] }) plus optimizeDeps: { include: ["react/compiler-runtime"] }. On our app this took the build from 2.7s to 1.9s.

Activity

  1. locked and limited conversation to collaborators on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions