Skip to content

Commit 50c4120

Browse files
Copilotpranaygp
andcommitted
Remove Turbopack loader configuration that breaks JSX transform
Co-authored-by: pranaygp <[email protected]>
1 parent e041be7 commit 50c4120

File tree

3 files changed

+22
-46
lines changed

3 files changed

+22
-46
lines changed

packages/next/src/index.ts

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { NextBuilder } from './builder.js';
22
import type { NextConfig } from 'next';
3-
import semver from 'semver';
43

54
export function withWorkflow(
65
nextConfigOrFn:
@@ -51,35 +50,10 @@ export function withWorkflow(
5150
// shallow clone to avoid read-only on top-level
5251
nextConfig = Object.assign({}, nextConfig);
5352

54-
// configure the loader if turbopack is being used
55-
if (!nextConfig.turbopack) {
56-
nextConfig.turbopack = {};
57-
}
58-
if (!nextConfig.turbopack.rules) {
59-
nextConfig.turbopack.rules = {};
60-
}
61-
const existingRules = nextConfig.turbopack.rules as any;
62-
const nextVersion = require('next/package.json').version;
63-
const supportsTurboCondition = semver.gte(nextVersion, 'v16.0.0');
64-
65-
for (const key of ['*.tsx', '*.ts', '*.jsx', '*.js']) {
66-
nextConfig.turbopack.rules[key] = {
67-
...(supportsTurboCondition
68-
? {
69-
condition: {
70-
...existingRules[key]?.condition,
71-
any: [
72-
...(existingRules[key]?.condition.any || []),
73-
{
74-
content: /(use workflow|use step)/,
75-
},
76-
],
77-
},
78-
}
79-
: {}),
80-
loaders: [...(existingRules[key]?.loaders || []), loaderPath],
81-
};
82-
}
53+
// NOTE: Turbopack configuration is currently disabled due to conflicts with Next.js's
54+
// built-in TypeScript and JSX transform handling. The webpack loader below handles
55+
// workflow transformations for both webpack and turbopack builds.
56+
// TODO: Investigate proper Turbopack loader integration that doesn't override defaults.
8357

8458
// configure the loader for webpack
8559
const existingWebpackModify = nextConfig.webpack;
Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
import type { Metadata } from 'next';
2-
import { Geist, Geist_Mono } from 'next/font/google';
32
import './globals.css';
43

5-
const geistSans = Geist({
6-
variable: '--font-geist-sans',
7-
subsets: ['latin'],
8-
});
9-
10-
const geistMono = Geist_Mono({
11-
variable: '--font-geist-mono',
12-
subsets: ['latin'],
13-
});
14-
154
export const metadata: Metadata = {
165
title: 'Durable Agents',
176
description: 'A durable agent using the new Workflow DevKit',
@@ -24,11 +13,7 @@ export default function RootLayout({
2413
}>) {
2514
return (
2615
<html lang="en">
27-
<body
28-
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
29-
>
30-
{children}
31-
</body>
16+
<body className="antialiased">{children}</body>
3217
</html>
3318
);
3419
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Test file WITHOUT "use workflow" or "use step" directives
2+
// This should use automatic JSX transform and NOT fail with "React is not defined"
3+
4+
export default function TestPage() {
5+
return (
6+
<div>
7+
<h1>JSX Transform Test</h1>
8+
<p>This component has JSX but no React import.</p>
9+
<p>If the automatic JSX transform works, this will render correctly.</p>
10+
<ul>
11+
<li>Item 1</li>
12+
<li>Item 2</li>
13+
<li>Item 3</li>
14+
</ul>
15+
</div>
16+
);
17+
}

0 commit comments

Comments
 (0)