Link to the code that reproduces this issue or a replay of the bug
https://github.com/sebpettersson/nextjs-dev-mode-bug
To Reproduce
If you use assetPrefix and rewrites in development mode you get "Error: Invariant: attempted to hard navigate to the same URL".
Sample config:
module.exports = {
reactStrictMode: true,
assetPrefix: "/dev-mode-bug",
rewrites: async () => [
{
source: `/dev-mode-bug/_next/static/:path*`,
destination: "/_next/static/:path*",
},
],
};
It looks like the files starting with _dev in _next/static/development/ is not being rewritten correctly and return 404s:
Current vs. Expected behavior
I expected assetPrefix and rewrites to not trigger any errors or 404s on critical files.
Verify canary release
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000
Binaries:
Node: 18.13.0
npm: 8.19.3
Yarn: N/A
pnpm: 8.6.12
Relevant Packages:
next: 13.4.20-canary.26
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: 5.1.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Additional context
This issue was introduced in 13.4.13-canary.0. 13.4.12 works as expected.
Link to the code that reproduces this issue or a replay of the bug
https://github.com/sebpettersson/nextjs-dev-mode-bug
To Reproduce
If you use
assetPrefixand rewrites in development mode you get "Error: Invariant: attempted to hard navigate to the same URL".Sample config:
It looks like the files starting with
_devin_next/static/development/is not being rewritten correctly and return 404s:Current vs. Expected behavior
I expected
assetPrefixand rewrites to not trigger any errors or 404s on critical files.Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 Binaries: Node: 18.13.0 npm: 8.19.3 Yarn: N/A pnpm: 8.6.12 Relevant Packages: next: 13.4.20-canary.26 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.3 Next.js Config: output: N/AWhich area(s) are affected? (Select all that apply)
Not sure
Additional context
This issue was introduced in
13.4.13-canary.0.13.4.12works as expected.