Skip to content

Commit

Permalink
support publicPath auto
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiSoroka committed Mar 18, 2022
1 parent de71144 commit 0a3e3b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions packages/@vue/cli-service/lib/commands/serve.js
Expand Up @@ -116,9 +116,7 @@ module.exports = (api, options) => {
protocol,
host,
port,
isAbsoluteUrl(options.publicPath) || options.publicPath === 'auto'
? '/'
: options.publicPath
isAbsoluteUrl(process.env.BASE_URL) ? '/' : process.env.BASE_URL
)
const localUrlForBrowser = publicUrl || urls.localUrlForBrowser

Expand Down Expand Up @@ -189,7 +187,7 @@ module.exports = (api, options) => {
'text/html',
'application/xhtml+xml'
],
rewrites: genHistoryApiFallbackRewrites(options.publicPath, options.pages)
rewrites: genHistoryApiFallbackRewrites(process.env.BASE_URL, options.pages)
},
hot: !isProduction
}, projectDevServerOptions, {
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-service/lib/util/resolveClientEnv.js
Expand Up @@ -7,7 +7,7 @@ module.exports = function resolveClientEnv (options, raw) {
env[key] = process.env[key]
}
})
env.BASE_URL = options.publicPath
env.BASE_URL = options.publicPath === 'auto' ? '' : options.publicPath

if (raw) {
return env
Expand Down

0 comments on commit 0a3e3b9

Please sign in to comment.