Skip to content
Discussion options

You must be logged in to vote

Hey @BruceHubbard , solid question—React Compiler's React 18 setup trips folks up since it defaults to 19 mode.

Quick fix:

  1. Install the runtime: npm install react-compiler-runtime@latest

  2. Update next.config.mjs like this (options pass straight to the Babel plugin):

    /** @type {import('next').NextConfig} */
    const nextConfig = {
      reactCompiler: {
        target: '18',
        runtimeModule: 'react-compiler-runtime',
      },
      // your other stuff
    };
    
    export default nextConfig;
  3. Grab the plugin if missing: npm install -D babel-plugin-react-compiler@latest

  4. Restart dev server. That should kill the import error. Works for Pages Router too (docs lag a bit).

If Turbopack's in play and it still flakes,…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@timkindberg
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@BruceHubbard
Comment options

@icyJoseph
Comment options

@Arjun-M
Comment options

Answer selected by BruceHubbard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants