Skip to content

@workflow/next loader breaks automatic JSX transform (React is not defined during SSR) #212

@realestate-v2

Description

@realestate-v2

After enabling Workflow in next.config.mjs:

import { withWorkflow } from '@workflow/next';
export default withWorkflow({ reactStrictMode: true });

some .tsx files without "use workflow" or "use step" fail during SSR with:

ReferenceError: React is not defined

The generated server bundle contains React.createElement(...) but no import React, meaning the automatic JSX transform isn’t applied.

Findings

  • The loader (@workflow/next/dist/loader.js) short-circuits by returning the raw source when no directive is found.
  • Because it runs before Next’s SWC, those files skip the automatic JSX transform and fall back to the classic runtime.
  • On branches without the Workflow wrapper, everything renders normally.

Expected
Files without Workflow directives should still use Next’s automatic JSX transform (react/jsx-runtime) and not require a React import.

Environment

  • Next.js 16.0.1
  • React 19
  • @workflow/next 4.0.1-beta.6
  • Node 22

Disclaimer: We are newcomers and this issue analysis was created using AI. Really sorry if this is not the correct way or place to open this issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions