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

<Link href="/" /> navigates to {basePath}.txt page #49866

Open
1 task done
ethanneff opened this issue May 16, 2023 · 4 comments
Open
1 task done

<Link href="/" /> navigates to {basePath}.txt page #49866

ethanneff opened this issue May 16, 2023 · 4 comments
Labels
bug Issue was opened via the bug report template.

Comments

@ethanneff
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.14.2
      npm: 9.6.5
      Yarn: 1.22.19
      pnpm: 7.31.0
    Relevant packages:
      next: 13.4.2
      eslint-config-next: 13.4.2
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.0.4

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue

n/a

To Reproduce

config

const isProd = process.env.NODE_ENV === "production";

const repoName = "test";

/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    appDir: true,
  },
  assetPrefix: isProd ? `/${repoName}/` : "",
  basePath: isProd ? `/${repoName}` : "",
  images: { unoptimized: true },
  output: "export",
  generateBuildId: async () => {
    // You can, for example, get the latest git commit hash here
    return "my-build-id";
  },
};

module.exports = nextConfig;

code

    <Link
      href="/"
    >
      Nav Home
    </Link>

results on prod

https://fitnessxengineer.github.io/test.txt

Describe the Bug

it should navigate to the basePath, not basePath.txt

https://fitnessxengineer.github.io/test.txt

Expected Behavior

https://fitnessxengineer.github.io/test/

Which browser are you using? (if relevant)

chrome

How are you deploying your application? (if relevant)

github pages

@ethanneff ethanneff added the bug Issue was opened via the bug report template. label May 16, 2023
@ciruz
Copy link
Contributor

ciruz commented May 16, 2023

Its a known issue:

#48996

#48414

@dscafati
Copy link

This is fixed at least on 13.4.7, could you please check that?

@dawi
Copy link

dawi commented Jun 29, 2023

We also had this issue, but with 13.4.7 it works as expected. 👍

@yacine-karim
Copy link

hello @dscafati, i'm currently facing the same issue, and i also tested the 13.4.7

package.json:
"next": "13.4.7",

terminal output:

 HTTP  11/7/2023 4:54:07 PM ::1 GET /articles/b9975ce8.txt?_rsc=de8ecb9
 HTTP  11/7/2023 4:54:07 PM ::1 Returned 404 in 5 ms
 HTTP  11/7/2023 4:54:08 PM ::1 GET /articles/b9975ce8
 HTTP  11/7/2023 4:54:08 PM ::1 Returned 404 in 2 ms

it works fine on dev localhost, i get the issue only in the build version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

5 participants