I'm trying to generate a static website with nuxt but I need it to work without a server, just opening the html files with a browser. One of the problems are the urls of the assets imported in the html files because I need the url to be
src="_nuxt/..."
instead of
src="/_nuxt/..."
is it possible to change this config?
CodePudding user response:
AFAIK, there is no way to do this with nuxt. Because you're trying to change absolute paths to relatives, which is not really the way it's intented to work.
But a simple solution is to use npx serve
to run a local http server to serve your static files easily:
$ npx serve
┌─────────────────────────────────────────┐
│ │
│ Serving! │
│ │
│ - Local: http://localhost:3000 │
│ - Network: http://XX:XX:XX:XX:3000 │
│ │
│ Copied local address to clipboard! │
│ │
└─────────────────────────────────────────┘
Just go to this address and you'll see the files in the folder you executed the command :)