Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc5cfefb

Browse files
authored
Better handling ofpublicPath: 'auto' (#7005)
1 parent75826d6 commitc5cfefb

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const {
55
hasProjectPnpm,
66
IpcMessenger
77
}=require('@vue/cli-shared-utils')
8+
constgetBaseUrl=require('../util/getBaseUrl')
89

910
constdefaults={
1011
host:'0.0.0.0',
@@ -14,6 +15,7 @@ const defaults = {
1415

1516
/**@type {import('@vue/cli-service').ServicePlugin} */
1617
module.exports=(api,options)=>{
18+
constbaseUrl=getBaseUrl(options)
1719
api.registerCommand('serve',{
1820
description:'start development server',
1921
usage:'vue-cli-service serve [options] [entry]',
@@ -116,7 +118,7 @@ module.exports = (api, options) => {
116118
protocol,
117119
host,
118120
port,
119-
isAbsoluteUrl(options.publicPath) ?'/' :options.publicPath
121+
isAbsoluteUrl(baseUrl) ?'/' :baseUrl
120122
)
121123
constlocalUrlForBrowser=publicUrl||urls.localUrlForBrowser
122124

@@ -187,7 +189,7 @@ module.exports = (api, options) => {
187189
'text/html',
188190
'application/xhtml+xml'
189191
],
190-
rewrites:genHistoryApiFallbackRewrites(options.publicPath,options.pages)
192+
rewrites:genHistoryApiFallbackRewrites(baseUrl,options.pages)
191193
},
192194
hot:!isProduction
193195
},projectDevServerOptions,{
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports=functiongetBaseUrl(options){
2+
returnoptions.publicPath==='auto' ?'' :options.publicPath
3+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
constgetBaseUrl=require('./getBaseUrl')
12
constprefixRE=/^VUE_APP_/
23

34
module.exports=functionresolveClientEnv(options,raw){
@@ -7,7 +8,7 @@ module.exports = function resolveClientEnv (options, raw) {
78
env[key]=process.env[key]
89
}
910
})
10-
env.BASE_URL=options.publicPath
11+
env.BASE_URL=getBaseUrl(options)
1112

1213
if(raw){
1314
returnenv

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp