3.0.0-alpha.13
Make a vue.config.js with
module.exports = {
baseUrl: ''
}
execute npm run build
.
An index.html file is created with relative link, f.e. href=js/... etc.
I get an error that baseUrl cannot be empty.
A simple workaround is
module.exports = {
configureWebpack: {
output: {
publicPath: '',
},
},
};
This is actually the default value for publicPath, so it is weird that baseUrl does not allow this value.
Hmm, publicPath
or baseUrl
should either be /
or .
. Does .
work for you?
.
almost works, there is another bug that generates a url .css/...
@sjoerdvisscher that seems to be a legit bug - can you provide some more details?
I get:
<link rel="shortcut icon" href=.favicon.ico><title>mmm</title><link rel=preload as=script href=.js/vendor.b654b3dd.js><link rel=preload as=script href=.js/app.8878312f.js><link rel=preload as=style href=.css/app.d8788300.css>
The actual stylesheet link and the script src urls are correct. (They start with ./
)
But why can't it be the empty string, it's the default for webpack: https://webpack.js.org/configuration/output/#output-publicpath
basePath: './'
does work properly, so I'll be using that for now.
Can this issue be reevaluated? Motivation is as follows:
We've tried all permutations of baseUrl
values (''
, '.'
, './'
, '/'
) and none of these allow the build process to output relative paths (e.g., src="assets/image.png"
).
To achieve this it seems the baseUrl
should be set to ''
, but this is not allowed currently. What is the reasoning behind this? Is there a way to achieve relative references to assets such as in the example above?
This will be possible in the next release.
Sorry to be a troll, but are the docs just made up then? I dont think I ever heard of premature documentation. https://cli.vuejs.org/config/#baseurl
Most helpful comment
This will be possible in the next release.