Next.js Discord

Discord Forum

Next 14.2.3 regression: The requested module <MODULE> contains conflicting star exports for the name

Unanswered
Arboreal ant posted this in #help-forum
Open in Discord
Arboreal antOP
Hi All,

I just bumped from v14.1.0 to v14.2.3 and previously working code suddenly throws loads of errors. The same code worked great in v13.4.9 and v14.1.0, so this seems to be a regression.

 ○ Compiling /dashboard ...
 ⚠ ./src/common/gen/api/codegen-index.ts
...
./src/common/gen/api/codegen-index.ts
The requested module './HealthApi' contains conflicting star exports for the name '$$ACTION_0' with the previous requested module './AuthApi'


I've got dozens of these errors for some fetch actions that are in a folder.

The action files look like this:

/*
* This file is auto generated - do not edit manually
*/
"use server"

import { notFound, redirect } from 'next/navigation';
import { cookies, headers } from 'next/headers';
import { ActionResult, handleError, signInUrl } from './index';
import {
  healthGetFetch
} from '@/common/gen';

export const healthGet = async (requestInitArgs: Omit<RequestInit, 'body'>): Promise<ActionResult<unknown>> => {
  const reqHeaders = new Headers();

  const reqCookies = cookies();

  reqHeaders.set('cookie', reqCookies.toString());

  const res = await healthGetFetch({
    headers: reqHeaders,
    ...requestInitArgs
  });


  if(res.status === 401) {
    redirect(signInUrl);
  }

  if(res.status === 404) {
    notFound();
  }

  if(res.status >= 400) {
    return handleError<unknown>({tag: 'healthGet', res})  
  }

  // TODO: Implement handling non jsonable responses
  const responseBody = await res.json();

  return {data: responseBody as unknown, error: null };
};


For some reason this HealthApi.ts has an error saying there's a conflicting export, but the only export is the healthGet which is unique in the nextjs app.

It looks like webpack is exporting this named fn as $$ACTION_0 instead of healthGet.

The codegen-index.ts file is just barrel exports like export * from './HealthApi';. That should still have them named right?

Any tips on fixing this?

1 Reply

Arboreal antOP
bump