2

From the docs I tried all options resembling the one I need:

export default defineNuxtConfig({
  build: {
    baseURL: '/myProject',
    workspaceDir: '/myProject',
    rootDir: '/myProject'
  }
})

Nothing works. In myProject/.output/public/index.html, I still see <script type="module" src="/_nuxt/entry.4419fff1.js" crossorigin></script> and I'm getting 404 console error:

GET http://127.0.0.1/_nuxt/entry.4419fff1.js net::ERR_ABORTED 404 (Not Found)

Any idea how to make it work?

kissu
  • 40,416
  • 14
  • 65
  • 133
drake035
  • 3,955
  • 41
  • 119
  • 229
  • 1
    I think you're misunderstanding what it is for. Can you post you project structure? – Jason Landbridge Nov 07 '22 at 15:15
  • Now do you build/preview your project? – kissu Nov 07 '22 at 15:25
  • It's a new Nuxt project I created in a `myProject` sub-folder on my server. I build it through `npx nuxi generate` command which automatically creates an `.output/public` sub-folders inside my `myProject` project folder. – drake035 Nov 07 '22 at 20:40

1 Answers1

1

You can now run yarn preview (or anything related, check your package.json, scripts section) to see how it looks.
As also explained here: https://stackoverflow.com/a/72103370/8816585

kissu
  • 40,416
  • 14
  • 65
  • 133
  • Thanks but that's not what I want to do. I need to build the app because it fetches data from an Apache/mySQL backend living on the same server to avoid CORS issues, therefore I have to build the app every time I need to test it (which is extremely annoying but I see no other way to work around the CORS problem) – drake035 Nov 08 '22 at 09:54
  • @drake035 fix the CORS. Probably the simplest/most efficient way when dealing with a problem: solve the problem. Rather than using a workaround. https://stackoverflow.com/a/72211930/8816585 – kissu Nov 08 '22 at 10:06
  • 1
    I fixed my CORS issue using the answer of yours that you linked, thanks man! – drake035 Nov 08 '22 at 11:11