1
votes

I created a small SPA Nuxt.js app and I’m having a hosting issue.

I’m trying to upload the app to a static hosting in bluehost. Under the domain name I created a sub-folder where I would like to run the app. (www.domain.com/myapp/)

I ran the command NUXT Generate to generate the static folder (Dist) - When I upload the content of the Dist folder to the folder myapp in the server and try to access it, it does not work.

I can access index.html but everything is broken. The reason is because it is looking for all the files in the domain’s root folder and not in the myapp folder.

I there a way I can tell the generate command to use the myapp folder path as its root folder?

Any help figuring this out would be greatly appreciated.

Thanks

CES

1

1 Answers

3
votes

You have to set the base path for the router in your nuxt config file:

// nuxt.config.js

export default {
  router: {
    base: '/myapp/'
  },
  // ...
}

see nuxt documentation