Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/docs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ module.exports = {
compiler: {
styledComponents: true,
},
// Turbopack configuration (used by default in Next.js 16+)
turbopack: {
rules: {
'*.{ts,tsx}': {
condition: {
all: [
{ not: 'foreign' }, // Exclude node_modules
{
any: [
{ path: /^packages\/docs\/pages\// },
{ path: /^packages\/docs\/components\// },
{ path: /^packages\/docs\/PropTables\// },
],
},
],
},
loaders: ['jsx-to-string-loader'],
},
},
},
// Webpack configuration (fallback when using --webpack flag)
webpack: (config) => {
return {
...config,
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@types/styled-components": "^5.1.34",
"eslint-plugin-mdx": "^3.6.2",
"jsx-to-string-loader": "^1.2.0",
"next": "^15.5.7",
"next": "^16.0.8",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Next.js 16's default Turbopack conflicts with existing webpack() configuration, causing build failure.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

When running next build with Next.js 16.0.8, Turbopack becomes the active bundler by default. The packages/docs/next.config.js contains a custom webpack() configuration for jsx-to-string-loader. Next.js 16 intentionally aborts the build when a traditional webpack() configuration is detected alongside Turbopack, leading to an immediate build failure. The package.json scripts do not include the --webpack flag to opt out of Turbopack, nor is there a turbopack.rules configuration to replace the webpack setup.

💡 Suggested Fix

Migrate the jsx-to-string-loader configuration to Turbopack's turbopack.rules format, or add the --webpack flag to the next build script in package.json to opt out of Turbopack.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: packages/docs/package.json#L50

Potential issue: When running `next build` with Next.js 16.0.8, Turbopack becomes the
active bundler by default. The `packages/docs/next.config.js` contains a custom
`webpack()` configuration for `jsx-to-string-loader`. Next.js 16 intentionally aborts
the build when a traditional `webpack()` configuration is detected alongside Turbopack,
leading to an immediate build failure. The `package.json` scripts do not include the
`--webpack` flag to opt out of Turbopack, nor is there a `turbopack.rules` configuration
to replace the webpack setup.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 6415171

"typescript": "^5.9.3"
}
}
Loading