I'm running a Next.js dev server. When I go to page #1, then click a link to page #2, it works great. (Just to clarify, I'm not using the as prop of Next's <Link> tag, just the regular old href.)
However, if I then refresh page #2, the page itself loads, as do all the images ... but all of the Javascript files fail with a 404:
http://localhost:3000/page2/_next/static/chunks/main.js?ts=1612664646023 net::ERR_ABORTED 404 (Not Found) 2localhost/:196 GET
http://localhost:3000/page2/_next/static/development/_buildManifest.js?ts=1612664646023 net::ERR_ABORTED 404 (Not Found) 2localhost/:1 GET
http://localhost:3000/page2/_next/static/chunks/webpack.js?ts=1612664646023 net::ERR_ABORTED 404 (Not Found) 7localhost/:196 GET
http://localhost:3000/page2/_next/static/chunks/main.js?ts=1612664646023 net::ERR_ABORTED 404 (Not Found)
Does anyone know what I can do to fix this?
basePathon yournext.config.json?basePath(but I triedbasePath: ''and it didn't help. Page #1 isindex.js, while page #2 is a dynamic route, ie.something/somethingElse/[someVar]. And again that dynamic route works, when I click a link from index ... just not when I refresh after :(basePaththen why is it trying to load the files from/page2/_next/...? Have you tried deleting your.next/folder then build and run again?next devagain. Then the problem solved