NextJS assetPrefix and basePath prefix not taking effect

Viewed 8225

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:

enter image description here

So it's just the root basePath field that isn't working.

1 Answers
Related