Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The baseUrl option cannot be empty #900

Closed
sjoerdvisscher opened this issue Feb 28, 2018 · 8 comments
Closed

The baseUrl option cannot be empty #900

sjoerdvisscher opened this issue Feb 28, 2018 · 8 comments
Labels

Comments

@sjoerdvisscher
Copy link

Version

3.0.0-alpha.13

Steps to reproduce

Make a vue.config.js with

module.exports = {
  baseUrl: ''
}

execute npm run build.

What is expected?

An index.html file is created with relative link, f.e. href=js/... etc.

What is actually happening?

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.

@yyx990803
Copy link
Member

Hmm, publicPath or baseUrl should either be / or .. Does . work for you?

@sjoerdvisscher
Copy link
Author

. almost works, there is another bug that generates a url .css/...

@yyx990803
Copy link
Member

@sjoerdvisscher that seems to be a legit bug - can you provide some more details?

@sjoerdvisscher
Copy link
Author

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

@sjoerdvisscher
Copy link
Author

basePath: './' does work properly, so I'll be using that for now.

@lsorber
Copy link

lsorber commented Jun 5, 2018

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?

@yyx990803
Copy link
Member

This will be possible in the next release.

@stofte
Copy link

stofte commented Jun 26, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants