Home

Issue: 3125

SPA, no webserver and routing (this page could not be found)

[issue link]

So I have a fully working nuxt app (I cloned this example project: roberto-butti/nuxtjs-helloworld - Obviously I fixed the package.json nuxt version constraints and am running the newest 1.4.0). Now I want to use the --spa mode to build a single page app, put it into a cordova container and build a (iOS/Android) App out of it.

I am now running into a couple of problems:

  • Should I use the contents of my generated dist dir or of the .nuxt/dist dir for my app?
  • Many paths are now wrong. Cordova obviously does not have any local webserver running, so the pages are opened via file://... - So I tried this “hack” and it works beautifully, the paths to the files work now!
  • The routing is not working now - I always end up on nuxt’s “This page could not be found” error page.

All these errors already occur when I only open the index.html in my desktop browser from the dist dir - so they are completely Cordova unrelated!

Did anyone try already to combine the SPA mode and cordova and was successful? I am a bit confused now on what I have to do to get this running.

If nuxt/vue-js definitely needs a local webserver to work properly, even in SPA mode, then maybe floatinghotpot/cordova-httpd can help?

best, P

This question is available on Nuxt.js community (#c2706)