I'm unsuccessfully attempting to create a simple NextJS site that has a /app
prefix on all the links. So that on the home page (which has a link to /about
), the About link should end up as /app/about
.
(updated based on comments below) My next.config.js
file looks like this:
module.exports = {
assetPrefix: "/app",
publicRuntimeConfig: {
basePath: "/app",
},
basePath: "/app",
};
And my package.json
's scripts section has:
"build": "next build && next export",
However, when I copy the contents of the generated out
folder into my web server, the index page's "About" link always points to /about
without the desired prefix. What could be causing that? It appears as though the assetPrefix
value is working:
So it's just the root basePath
field that isn't working.
This issue has been reported as fixed recently. https://github.com/vercel/next.js/pull/9872
Try to use the most recent canary release. At this moment it's 9.5.2-canary.18
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With