Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Next 14.2.0 #19

Open
zbeyens opened this issue Apr 12, 2024 · 5 comments
Open

Support Next 14.2.0 #19

zbeyens opened this issue Apr 12, 2024 · 5 comments

Comments

@zbeyens
Copy link

zbeyens commented Apr 12, 2024

I'm getting this error after installing next@14.2.0:

⨯ ./node_modules/.pnpm/next-safe-navigation@0.3.1_next@14.2.0_typescript@5.4.5_zod@3.22.4/node_modules/next-safe-navigation/dist/index.mjs
Attempted import error: 'useParams' is not exported from 'next/navigation' (imported as 'x').
Import trace for requested module:
./node_modules/.pnpm/next-safe-navigation@0.3.1_next@14.2.0_typescript@5.4.5_zod@3.22.4/node_modules/next-safe-navigation/dist/index.mjs
./src/lib/navigation/routes.ts
./src/app/not-found.tsx

@lukemorales
Copy link
Owner

@zbeyens can you try a fresh install (removing node_modules)? I have a local project with next@14.2.0 and I'm unable to reproduce nor has the export from useParams changed in the new version

@zbeyens
Copy link
Author

zbeyens commented Apr 12, 2024

It's still happening 😕

It happens when I use routes in an RSC using the edge runtime, but not when using nodejs. For example:

export const runtime = 'edge';

export default function NotFound() {
  return (
        <div className="space-y-4 pt-32 text-center">
          <h2 className="font-heading text-6xl">404</h2>
          <p className="text-subtle-foreground">Couldn't find this page</p>
          <Link href={routes.home()}>
            Back to home
          </LinkButton>
        </div>
  );
}

@jln13x
Copy link

jln13x commented Apr 13, 2024

CleanShot 2024-04-13 at 14 42 58@2x

Next 14.2.1

@statusunknown418
Copy link

statusunknown418 commented Apr 15, 2024

getting this on 14.2.1

Failed to compile.

./node_modules/.pnpm/next-safe-navigation@0.3.1_next@14.2.1_typescript@5.4.5_zod@3.22.4/node_modules/next-safe-navigation/dist/index.mjs
Attempted import error: 'useParams' is not exported from 'next/navigation' (imported as 'x').

Import trace for requested module:
./node_modules/.pnpm/next-safe-navigation@0.3.1_next@14.2.1_typescript@5.4.5_zod@3.22.4/node_modules/next-safe-navigation/dist/index.mjs
./src/lib/navigation.ts
./src/server/auth.ts
./src/app/api/auth/[...nextauth]/route.ts
./node_modules/.pnpm/next@14.2.1_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fapi%2Fauth%2F%5B...nextauth%5D%2Froute&page=%2Fapi%2Fauth%2F%5B...nextauth%5D%2Froute&pagePath=private-next-app-dir%2Fapi%2Fauth%2F%5B...nextauth%5D%2Froute.ts&appDir=%2FUsers%2Fa3tech%2FDeveloper%2Fpersonal_projects%2Fthearq%2Fsrc%2Fapp&appPaths=%2Fapi%2Fauth%2F%5B...nextauth%5D%2Froute&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&basePath=&assetPrefix=&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!./src/app/api/auth/[...nextauth]/route.ts?__next_edge_ssr_entry__

even after deleting/reinstalling the issue persists @lukemorales

@statusunknown418
Copy link

guys the issue for me was that it was being imported into an auth.ts (nextauth v5) file and was using edge, removing it solved the issue

// ...
      if (publicRoutes.includes(request.nextUrl.pathname)) { // publicRoutes was imported from the nav.ts where next-safe-navigation was used
        return NextResponse.next();
      }
// ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants