Skip to content

chore!: remove the already-deprecated baseUrl option #4388

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

Merged
merged 1 commit into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions packages/@vue/cli-service/__tests__/Service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ const fs = require('fs')
const path = require('path')
const Service = require('../lib/Service')

const { logs } = require('@vue/cli-shared-utils')

const mockPkg = json => {
fs.writeFileSync('/package.json', JSON.stringify(json, null, 2))
}
Expand Down Expand Up @@ -84,29 +82,6 @@ test('load project options from package.json', () => {
expect(service.projectOptions.lintOnSave).toBe('default')
})

test('deprecate baseUrl', () => {
mockPkg({
vue: {
baseUrl: './foo/bar'
}
})
createMockService()
expect(logs.warn.some(([msg]) => msg.match('is deprecated now, please use "publicPath" instead.')))
})

test('discard baseUrl if publicPath also exists', () => {
mockPkg({
vue: {
baseUrl: '/foo/barbase/',
publicPath: '/foo/barpublic/'
}
})

const service = createMockService()
expect(logs.warn.some(([msg]) => msg.match('"baseUrl" will be ignored in favor of "publicPath"')))
expect(service.projectOptions.publicPath).toBe('/foo/barpublic/')
})

test('handle option publicPath and outputDir correctly', () => {
mockPkg({
vue: {
Expand Down
17 changes: 0 additions & 17 deletions packages/@vue/cli-service/lib/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,28 +346,11 @@ module.exports = class Service {
resolvedFrom = 'inline options'
}

if (typeof resolved.baseUrl !== 'undefined') {
if (typeof resolved.publicPath !== 'undefined') {
warn(
`You have set both "baseUrl" and "publicPath" in ${chalk.bold('vue.config.js')}, ` +
`in this case, "baseUrl" will be ignored in favor of "publicPath".`
)
} else {
warn(
`"baseUrl" option in ${chalk.bold('vue.config.js')} ` +
`is deprecated now, please use "publicPath" instead.`
)
resolved.publicPath = resolved.baseUrl
}
}

// normalize some options
ensureSlash(resolved, 'publicPath')
if (typeof resolved.publicPath === 'string') {
resolved.publicPath = resolved.publicPath.replace(/^\.\//, '')
}
// for compatibility concern, in case some plugins still rely on `baseUrl` option
resolved.baseUrl = resolved.publicPath
removeSlash(resolved, 'outputDir')

// validate options
Expand Down
3 changes: 0 additions & 3 deletions packages/@vue/cli-service/lib/options.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { createSchema, validate } = require('@vue/cli-shared-utils')

const schema = createSchema(joi => joi.object({
baseUrl: joi.string().allow(''),
publicPath: joi.string().allow(''),
outputDir: joi.string(),
assetsDir: joi.string().allow(''),
Expand Down Expand Up @@ -79,8 +78,6 @@ function hasMultipleCores () {
exports.defaults = () => ({
// project deployment base
publicPath: '/',
// for compatibility concern. TODO: remove in v4.
baseUrl: '/',

// where to output built files
outputDir: 'dist',
Expand Down
4 changes: 0 additions & 4 deletions packages/@vue/cli-ui/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,6 @@
"general": "General settings",
"css": "CSS settings"
},
"baseUrl": {
"label": "Base URL",
"description": "The base URL your application will be deployed at, for example '/my-app/'. Use an empty string ('') so that all assets are linked using relative paths."
},
"publicPath": {
"label": "Public Path",
"description": "The base URL your application will be deployed at, for example '/my-app/'. Use an empty string ('') so that all assets are linked using relative paths."
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-ui/ui-defaults/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = api => {
name: 'publicPath',
type: 'input',
default: '/',
value: data.vue && (data.vue.publicPath || data.vue.baseUrl), // fallback to baseUrl for compatibility
value: data.vue && data.vue.publicPath,
message: 'org.vue.vue-webpack.config.vue-cli.publicPath.label',
description: 'org.vue.vue-webpack.config.vue-cli.publicPath.description',
group: 'org.vue.vue-webpack.config.vue-cli.groups.general',
Expand Down