-
Notifications
You must be signed in to change notification settings - Fork 283
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
fix(nextjs): Ensure package works with next 12 #2652
Conversation
🦋 Changeset detectedLatest commit: 91703d8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { notFound, redirect } = require('next/navigation'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auth()
should never be used in v12, but due to the module structure of the package and the unconditional import of next/navigation
, in a CJS environment node was trying to resolve the next/navigation
import. Shifting this inline fixes it.
!snapshot |
Hey @BRKalow - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/nextjs@4.29.5-snapshot.v91703d8 --save-exact |
Description
Adjust how we import
next/navigation
in theauth()
helper to ensure our package can be safely imported in Next.js v12. The current recommended approach to usewebpack.IgnorePlugin
doesn't when the package is externally required in a CJS environment.Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change
Packages affected
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/clerk-expo
@clerk/fastify
gatsby-plugin-clerk
@clerk/localizations
@clerk/nextjs
@clerk/clerk-react
@clerk/remix
@clerk/clerk-sdk-node
@clerk/shared
@clerk/themes
@clerk/types
build/tooling/chore