Skip to content

Instantly share code, notes, and snippets.

@lubieowoce
Last active October 30, 2023 22:17
Show Gist options
  • Save lubieowoce/81db36303fa0c72575fc45e07210f8c9 to your computer and use it in GitHub Desktop.
Save lubieowoce/81db36303fa0c72575fc45e07210f8c9 to your computer and use it in GitHub Desktop.
Next 14.0.1: log more details for "This is not allowed due to cyclic module graph between Server and Client"
diff --git a/node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js b/node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js
index 59e02e7..0bf857b 100644
--- a/node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js
+++ b/node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js
@@ -43,6 +43,7 @@ function transformSource(source, sourceMap) {
// and we shouldn't error for that. In the future we might want to find a way
// to only throw when it's used.
if (!this.resourcePath.includes("node_modules")) {
+ console.log('uh oh:', this._module.resourceResolveData.context.issuer, '->', this._module.resource)
this.callback(new Error(`You're importing a Client Component ("use client") from another Client Component imported Server Action file ("use server"). This is not allowed due to cyclic module graph between Server and Client.\nYou can work around it by defining and passing this Server Action from a Server Component into the Client Component via props.`));
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment