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

feat: deprecate confusing baseUrl option, use publicPath instead. #3143

Merged
merged 3 commits into from
Jan 7, 2019

Conversation

haoqunjiang
Copy link
Member

In most cases we use baseUrl as a way to modify publicPath safely.
The name baseUrl did mislead some people: in some rare cases we want to modify the publicPath of static assets while not influencing the page url (#2788). In that case this option does not indicate the base location of the web page but the application bundle, publicPath would be a better and more common name for it.

(One exception is process.env.BASE_URL, I'm still wondering if we should rename that env variable too).

@haoqunjiang haoqunjiang merged commit e7af0d8 into vuejs:dev Jan 7, 2019
@IndexXuan
Copy link
Contributor

only change in vue.config.js and the same with baseUrl ?
why not use process.env.PUBLIC_URL like create-react-app ?

@haoqunjiang
Copy link
Member Author

@IndexXuan PUBLIC_URL is not the same as publicPath in webpack config.

@IndexXuan
Copy link
Contributor

@sodatea replace baseUrl as publicPath do the same with before ?
what different with publicPath and PUBLIC_URL in production

@haoqunjiang
Copy link
Member Author

haoqunjiang commented Jan 11, 2019

@IndexXuan
publicPath better reflects the actual usage of this option.

PUBLIC_URL is like BASE_URL in this PR. It's meant to be read-only and exposed by Vue CLI rather than the user.
I was thinking about changing the name too.

@IndexXuan
Copy link
Contributor

IndexXuan commented Jan 11, 2019

@sodatea Our product is a service that user upload source code and we build them and publish in CDN and html serve in somewhere. Our CI export PUBLIC_URL so that user not care about that, just use it in build scripts(Vue CLI 3 is vue.config.js#baseUrl before) and CRA user use PUBLIC_URL too.

Change baseUrl to publicPath is safely for us ?

strongly WANT PUBLIC_URL !!!

@haoqunjiang
Copy link
Member Author

Well, in that case, it’s safe to use publicPath, this PR is nothing more than a name change. They work identically underlyingly.

@IndexXuan
Copy link
Contributor

@sodatea this name change break some Vue CLI 3 plugin which use projectOptions#baseUrl, like:
https://github.com/longshihui/vue-cli-plugin-navigator/blob/master/service/index.js#L68

@haoqunjiang
Copy link
Member Author

haoqunjiang commented Jan 11, 2019

@IndexXuan Got it. Will fix it in the next patch. (By making publicPath and baseUrl truly interchangable)

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

Successfully merging this pull request may close these issues.

3 participants