Nuxt 3: Incorrect resource paths when using app.baseURL configuration

My site name: sparkling-mandazi-64484f url

Repo: GitHub - michaelvcolianna/nuxttest

What’s happening: I think this is a Nuxt config problem, and I created an issue in their repo, but in case there’s something Netlify knows I wanted to post here. I have the app.baseURL configuration option set and when the site is deployed, it’s looking in the wrong place for the various resources it needs. It’s prepending that baseURL (“test” in the case of the URL above) before the rest of the resource path, but that’s not the place it should be. Example:

What I know: The baseURL gets appended to the resource URL whether I use the catchall or use a pages/index.vue file. In the case of the catchall, a MIME error results because Nuxt serves a page. In the case of page routing or doc-driven routing, a 404 error results. (The finished site will need a catchall, so that’s why it’s there.)

What I’ve tried: On the Netlify side, I tried some redirects to no avail (plus the build hashes will change with each deploy). On the Nuxt side I tried changing the assets directories for Nitro and Vite, but you can’t use relative paths in those options, and anything you add gets prepended in addition to the baseURL. The incorrect JS URL above turns into

I feel like this has a simple answer and I’m just overlooking it, and googling wrong. If anyone has advice, it would be appreciated.

As far as I know, what you’re seeing is exactly what the baseURL property does? It puts the enitre app at a specific base folder.

Thanks for the response, hrishikesh! As far as I know, too, the property should do that. Since it’s not putting the scripts there, that’s why I’m guessing it’s a Nuxt thing. I just figured I’d check if anyone here had advice. (This feels like something at least one person would have encountered and solved.)

Hopefully, the Nuxt team takes a look at my ticket soon. If they do I’ll follow up here with the solution, even if it’s an unintended bug they will fix.

No wait, maybe you misunderstood (or maybe I did). But to clarify, what I mean is, when you’d set the baseURL to /test, all the assets should also be moved to /test. In other words, this:

sounds incorrect. If the assets exist at /test, that should be the expected behaviour.

Right, they don’t exist at /test so Nuxt is doing something funky. No reply from them yet but fingers crossed.

Nuxt has created a ticket for this under the Nitro repo, since it isn’t a Nuxt planned feature: netlify preset support for custom baseURL · Issue #1484 · unjs/nitro · GitHub

thanks for sharing this with the community.