Skip to content

V4 Nextjs 15 pages router "Failed to load external module" on any import #1795

@MrSimmmons

Description

@MrSimmmons

Checklist

Description

Using the Nextjs v15 Pages Router with the V4 readme (up to step 4 is enough) will fail to load or build with the following error in browser
Screenshot 2024-11-10 at 11 06 55 PM

and in terminal
Screenshot 2024-11-10 at 11 07 13 PM


I am able to successfully get all the exports to work if i manually import the exact path to the folders index file (or directly to the file its self.
Screenshot 2024-11-10 at 11 11 53 PM

Screenshot 2024-11-10 at 11 11 38 PM

Reproduction

  1. Create a V15 Pages router project using the create next app CLI https://nextjs.org/docs/pages/api-reference/cli/create-next-app
  2. Follow the getting started guide provided in the V4 readme (up to Step 4 is enough)
  3. Start the app in dev mode (will break with both webpack and turbopack bundlers)

Additional context

VSCode IntelliSense still works on the import functions and classes. So I can still command click them and VSCode will take me to their type sources, and autocomplete still functions. However this is annoying in this sense because the autocompleted "path" is causing the error and I have to manually modify the path as shown above to address it.


I noticed that the provided App Router example works fine so it must be just an issue with the Pages Router


Having your code in a /src directory or not makes no difference


The directory that the import errors are completing about are correct import paths (aside from maybe the file extension being omitted in the error? That might be the only thing that looks slightly off to me) as I can put them into finder and go to the correct place.

nextjs-auth0 version

V4.0.0 beta 0

Next.js version

15.0.3

Node.js version

20.18.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions