Nuxt generate packages to generate relative paths

how does packaging generate relative paths?
manually change the relative path to report an error?

clipboard.png

Mar.22,2021

nuxt.config.js settings in nuxt project:

module.exports = {
    router: {
    base: './'
    }
}

at the same time, change the reference mode of img to require ('~ / static/img/getting-started@3x.png')
, but there is still a problem, that is, the router jump is invalid. I don't know if you have encountered such a situation

. < hr >

the problem of router jump failure has been solved, so that mode: 'hash' can, and
specific code can access personal items: https://github.com/PLQin/nuxt.
if it is useful to you, please give me a star

.

I solved this. I wrote a middleware with node , and then replaced the dist directory.

Today, I made a npm package. You can try it. You can replace the static resources in the static file generated by nuxt generate with the relative file nuxt-relative-dir

.
Menu