Skip to content

Commit 2e3fa92

Browse files
authored
chore!: remove the already-deprecated baseUrl option (#4388)
1 parent d787448 commit 2e3fa92

File tree

5 files changed

+1
-50
lines changed

5 files changed

+1
-50
lines changed

packages/@vue/cli-service/__tests__/Service.spec.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ const fs = require('fs')
66
const path = require('path')
77
const Service = require('../lib/Service')
88

9-
const { logs } = require('@vue/cli-shared-utils')
10-
119
const mockPkg = json => {
1210
fs.writeFileSync('/package.json', JSON.stringify(json, null, 2))
1311
}
@@ -84,29 +82,6 @@ test('load project options from package.json', () => {
8482
expect(service.projectOptions.lintOnSave).toBe('default')
8583
})
8684

87-
test('deprecate baseUrl', () => {
88-
mockPkg({
89-
vue: {
90-
baseUrl: './foo/bar'
91-
}
92-
})
93-
createMockService()
94-
expect(logs.warn.some(([msg]) => msg.match('is deprecated now, please use "publicPath" instead.')))
95-
})
96-
97-
test('discard baseUrl if publicPath also exists', () => {
98-
mockPkg({
99-
vue: {
100-
baseUrl: '/foo/barbase/',
101-
publicPath: '/foo/barpublic/'
102-
}
103-
})
104-
105-
const service = createMockService()
106-
expect(logs.warn.some(([msg]) => msg.match('"baseUrl" will be ignored in favor of "publicPath"')))
107-
expect(service.projectOptions.publicPath).toBe('/foo/barpublic/')
108-
})
109-
11085
test('handle option publicPath and outputDir correctly', () => {
11186
mockPkg({
11287
vue: {

packages/@vue/cli-service/lib/Service.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -346,28 +346,11 @@ module.exports = class Service {
346346
resolvedFrom = 'inline options'
347347
}
348348

349-
if (typeof resolved.baseUrl !== 'undefined') {
350-
if (typeof resolved.publicPath !== 'undefined') {
351-
warn(
352-
`You have set both "baseUrl" and "publicPath" in ${chalk.bold('vue.config.js')}, ` +
353-
`in this case, "baseUrl" will be ignored in favor of "publicPath".`
354-
)
355-
} else {
356-
warn(
357-
`"baseUrl" option in ${chalk.bold('vue.config.js')} ` +
358-
`is deprecated now, please use "publicPath" instead.`
359-
)
360-
resolved.publicPath = resolved.baseUrl
361-
}
362-
}
363-
364349
// normalize some options
365350
ensureSlash(resolved, 'publicPath')
366351
if (typeof resolved.publicPath === 'string') {
367352
resolved.publicPath = resolved.publicPath.replace(/^\.\//, '')
368353
}
369-
// for compatibility concern, in case some plugins still rely on `baseUrl` option
370-
resolved.baseUrl = resolved.publicPath
371354
removeSlash(resolved, 'outputDir')
372355

373356
// validate options

packages/@vue/cli-service/lib/options.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const { createSchema, validate } = require('@vue/cli-shared-utils')
22

33
const schema = createSchema(joi => joi.object({
4-
baseUrl: joi.string().allow(''),
54
publicPath: joi.string().allow(''),
65
outputDir: joi.string(),
76
assetsDir: joi.string().allow(''),
@@ -79,8 +78,6 @@ function hasMultipleCores () {
7978
exports.defaults = () => ({
8079
// project deployment base
8180
publicPath: '/',
82-
// for compatibility concern. TODO: remove in v4.
83-
baseUrl: '/',
8481

8582
// where to output built files
8683
outputDir: 'dist',

packages/@vue/cli-ui/locales/en.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,6 @@
601601
"general": "General settings",
602602
"css": "CSS settings"
603603
},
604-
"baseUrl": {
605-
"label": "Base URL",
606-
"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."
607-
},
608604
"publicPath": {
609605
"label": "Public Path",
610606
"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."

packages/@vue/cli-ui/ui-defaults/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = api => {
1616
name: 'publicPath',
1717
type: 'input',
1818
default: '/',
19-
value: data.vue && (data.vue.publicPath || data.vue.baseUrl), // fallback to baseUrl for compatibility
19+
value: data.vue && data.vue.publicPath,
2020
message: 'org.vue.vue-webpack.config.vue-cli.publicPath.label',
2121
description: 'org.vue.vue-webpack.config.vue-cli.publicPath.description',
2222
group: 'org.vue.vue-webpack.config.vue-cli.groups.general',

0 commit comments

Comments
 (0)