Skip to content

Commit 0a3e3b9

Browse files
committed
support publicPath auto
1 parent de71144 commit 0a3e3b9

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

packages/@vue/cli-service/lib/commands/serve.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ module.exports = (api, options) => {
116116
protocol,
117117
host,
118118
port,
119-
isAbsoluteUrl(options.publicPath) || options.publicPath === 'auto'
120-
? '/'
121-
: options.publicPath
119+
isAbsoluteUrl(process.env.BASE_URL) ? '/' : process.env.BASE_URL
122120
)
123121
const localUrlForBrowser = publicUrl || urls.localUrlForBrowser
124122

@@ -189,7 +187,7 @@ module.exports = (api, options) => {
189187
'text/html',
190188
'application/xhtml+xml'
191189
],
192-
rewrites: genHistoryApiFallbackRewrites(options.publicPath, options.pages)
190+
rewrites: genHistoryApiFallbackRewrites(process.env.BASE_URL, options.pages)
193191
},
194192
hot: !isProduction
195193
}, projectDevServerOptions, {

packages/@vue/cli-service/lib/util/resolveClientEnv.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = function resolveClientEnv (options, raw) {
77
env[key] = process.env[key]
88
}
99
})
10-
env.BASE_URL = options.publicPath
10+
env.BASE_URL = options.publicPath === 'auto' ? '' : options.publicPath
1111

1212
if (raw) {
1313
return env

0 commit comments

Comments
 (0)